/* ============================================================
   Ayoon Kurdistan - Front-end styles
   ============================================================ */

/* The Rabar @font-face and the logo live in embed.css as base64,
   so they need no separate request. Load embed.css before this file. */

:root{
  --red:#d40b1e;
  --red-dark:#a80718;
  --navy:#143250;
  --navy-dark:#0d2138;
  --gold:#F0B40C;
  --red-light:#ff2b40;
  --green:#0a8f3c;
  --green-dark:#06692b;
  --ink:#14181f;
  --muted:#6b7480;
  --bg:#eaeef5;
  --card:#ffffff;
  --line:#dfe5ee;
  --buy-bg:linear-gradient(160deg,#f2fff6,#dcf6e6);
  --sell-bg:linear-gradient(160deg,#fff2f4,#ffe0e5);
  --radius:16px;
  --shadow:0 10px 30px rgba(20,30,60,.10);
  --shadow-sm:0 4px 14px rgba(20,30,60,.07);
}

*{box-sizing:border-box;margin:0;padding:0;}

html{scroll-behavior:smooth;}

body{
  font-family:'Rabar',system-ui,'Segoe UI',Tahoma,sans-serif;
  background:
    radial-gradient(900px 420px at 88% -160px, rgba(240,180,12,.16) 0%, transparent 70%),
    radial-gradient(1000px 520px at 12% -120px, rgba(20,50,80,.14) 0%, transparent 70%),
    var(--bg);
  background-attachment:fixed;
  color:var(--ink);
  min-height:100vh;
  direction:rtl;
  padding-bottom:96px;              /* room for the fixed footer bar */
  -webkit-font-smoothing:antialiased;
}

.wrap{max-width:760px;margin:0 auto;padding:18px 14px 30px;}

/* ---------------- Header ---------------- */
.site-head{
  background:
    radial-gradient(520px 260px at 88% -40%, rgba(240,180,12,.18), transparent 70%),
    linear-gradient(150deg,#1a3c60 0%,var(--navy) 45%,var(--navy-dark) 100%);
  border-radius:22px;
  box-shadow:0 18px 44px rgba(13,33,56,.30);
  padding:20px 20px 18px;
  position:relative;
  overflow:hidden;
  border:1px solid rgba(240,180,12,.22);
  color:#fff;
}
/* thin gold hairline along the top edge */
.site-head::before{
  content:'';position:absolute;inset:0 0 auto 0;height:3px;
  background:linear-gradient(90deg,transparent,var(--gold),#fff0c2,var(--gold),transparent);
  background-size:200% 100%;
  animation:slide 7s linear infinite;
}
/* soft watermark of the logo behind the card */
.site-head::after{
  content:'';position:absolute;
  left:-60px;bottom:-70px;width:230px;height:230px;
  background:var(--logo) center/contain no-repeat;
  opacity:.05;pointer-events:none;
}
@keyframes slide{to{background-position:200% 0;}}

/* --- logo on the right, name stretching off to the left --- */
.head-main{
  display:flex;align-items:center;gap:14px;
  text-align:right;
  position:relative;z-index:1;
  padding-right:2px;                /* keep the ring clear of the card corner */
}
/* logo sits in its own ring, mirroring the currency-row flags */
.logo{
  width:88px;height:88px;flex:none;
  background:var(--logo) center/contain no-repeat;
  border-radius:50%;
  box-shadow:0 0 0 2px rgba(240,180,12,.45), 0 8px 22px rgba(0,0,0,.45);
  animation:float 6s ease-in-out infinite;
}
@keyframes float{0%,100%{transform:translateY(0)}50%{transform:translateY(-6px)}}

/* the text block takes the rest of the row and runs toward the left */
.head-text{
  flex:1;min-width:0;
  display:flex;flex-direction:column;
  align-items:flex-start;
  padding-left:4px;
}
.name-ku{
  font-size:2.05rem;line-height:1.25;color:var(--gold);
  letter-spacing:.5px;font-weight:400;
  text-shadow:0 2px 10px rgba(0,0,0,.45);
  white-space:nowrap;
}
/* small latin name, like the IQD code under a currency */
.name-lat{
  font-family:system-ui,'Segoe UI',sans-serif;
  font-size:.72rem;font-weight:700;letter-spacing:3.5px;
  color:rgba(255,255,255,.55);
  direction:ltr;text-align:right;
  margin-top:1px;
}
/* gold hairline that stretches to the left edge of the card */
.name-lat::after{
  content:'';display:block;height:1px;margin-top:7px;
  background:linear-gradient(to left,var(--gold),rgba(240,180,12,.05));
}
.name-en{
  font-size:.84rem;font-weight:400;line-height:1.6;
  color:rgba(255,255,255,.8);margin-top:7px;
}

/* --- clock + live badge on one line --- */
.head-meta{
  display:flex;align-items:center;justify-content:space-between;
  gap:12px;flex-wrap:wrap;
  margin-top:16px;padding-top:14px;
  border-top:1px solid rgba(255,255,255,.14);
  position:relative;z-index:1;
}
.clock{display:flex;align-items:baseline;gap:10px;}
.clock .time{
  font-size:1.5rem;font-weight:700;color:#fff;
  font-variant-numeric:tabular-nums;letter-spacing:1px;
  font-family:system-ui,monospace;
  direction:ltr;
}
.clock .date{
  font-size:.9rem;color:rgba(255,255,255,.6);
  font-family:system-ui,sans-serif;direction:ltr;
}

.badge{
  display:inline-flex;align-items:center;gap:9px;
  padding:8px 18px;border-radius:999px;
  background:linear-gradient(135deg,var(--gold),#d99b00);
  color:#3a2a00;font-size:1rem;font-weight:700;
  box-shadow:0 6px 18px rgba(240,180,12,.35);
}
.badge .dot{
  width:9px;height:9px;border-radius:50%;background:#3a2a00;
  animation:pulse 1.5s ease-in-out infinite;
}
@keyframes pulse{
  0%,100%{opacity:1;box-shadow:0 0 0 0 rgba(58,42,0,.6)}
  50%{opacity:.5;box-shadow:0 0 0 8px rgba(58,42,0,0)}
}
.badge.closed{
  background:linear-gradient(135deg,#5a6472,#39414d);
  color:#fff;box-shadow:0 6px 18px rgba(0,0,0,.3);
}
.badge.closed .dot{background:#fff;}

/* ---------------- Rates table ---------------- */
.rates{margin-top:18px;position:relative;}

/* RTL grid: [flag + currency] -> buy -> sell, running right to left.
   The flag and the currency cell form one connected unit. */
.row{
  display:grid;
  grid-template-columns:1.7fr 1.3fr 1.3fr;
  gap:8px;align-items:stretch;margin-bottom:8px;
}
/* the flag caps the currency cell, overlapping it so the two read as one pill */
.cur-group{
  display:flex;align-items:center;
  min-width:0;
}
.cur-group .flag{
  order:2;                          /* RTL: the cell comes first, flag caps it */
  margin-right:-30px;               /* tuck INTO the cell, never past the group */
  position:relative;z-index:2;
}
.cur-group .cell{
  order:1;flex:1;min-width:0;
}
/* only rate rows carry a flag, so only they need the plug-in shape */
.rate-row .cur-group .cell{
  padding-left:42px;                /* room for the flag tucked on the edge */
  border-top-left-radius:999px;     /* rounded end that the flag plugs into */
  border-bottom-left-radius:999px;
}

.head-row{margin-bottom:10px;}
.head-row .cell{
  color:#fff;font-size:1.05rem;text-align:center;
  display:flex;flex-direction:column;justify-content:center;
  padding:10px 6px;border-radius:12px;line-height:1.35;
  font-family:system-ui,sans-serif;font-weight:700;letter-spacing:.5px;
}
.head-row .cur {
  background:linear-gradient(135deg,var(--navy),var(--navy-dark));
  box-shadow:0 6px 16px rgba(20,50,80,.28);
  border:1px solid rgba(240,180,12,.28);
}
.head-row .buy {
  background:linear-gradient(135deg,var(--green),var(--green-dark));
  box-shadow:0 6px 16px rgba(10,143,60,.26);
}
.head-row .sell{
  background:linear-gradient(135deg,var(--red),var(--red-dark));
  box-shadow:0 6px 16px rgba(212,11,30,.26);
}
.head-row .sub{
  font-size:.74rem;opacity:.88;font-weight:400;
  font-family:'Rabar',system-ui,sans-serif;
}

.rate-row{transition:transform .18s ease;}
.rate-row:hover{transform:translateX(-3px);}

.rate-row .cell{
  background:var(--card);border:1px solid var(--line);
  border-radius:12px;box-shadow:var(--shadow-sm);
  display:flex;align-items:center;justify-content:center;
  padding:12px 4px;font-size:1.45rem;font-weight:700;
  font-variant-numeric:tabular-nums;
  white-space:nowrap;direction:ltr;
  min-width:0;                       /* let the grid shrink this cell */
}
/* Long figures (millions) shrink to fit instead of spilling over.
   Viewport-based, so it works without container-query support. */
.rate-row .buy,
.rate-row .sell{font-size:clamp(.7rem,3.4vw,1.45rem);letter-spacing:-.2px;}
@media(min-width:760px){
  .rate-row .buy,
  .rate-row .sell{font-size:1.45rem;}
}
.rate-row .buy {background:var(--buy-bg);border-color:#c7ecd6;color:var(--green-dark);}
.rate-row .sell{background:var(--sell-bg);border-color:#ffd2d9;color:var(--red-dark);}

/* currency name sits on the right, code beneath it */
.rate-row .cur{
  flex-direction:column;align-items:flex-start;justify-content:center;
  gap:1px;padding:9px 14px;direction:rtl;
  background:linear-gradient(180deg,#fff,#f7f9fc);
  border-right:4px solid var(--gold);
}
/* keep the joint seamless: no border where the flag meets the cell */
.rate-row .cur-group .cell{border-left-color:transparent;}
.rate-row .cur .ku{
  color:var(--navy);font-weight:400;font-size:1.3rem;line-height:1.25;
}
.rate-row .cur .code{
  color:var(--muted);font-size:.82rem;letter-spacing:1.5px;font-weight:700;
  font-family:system-ui,sans-serif;direction:ltr;
}

.flag{
  width:50px;height:50px;flex:none;border-radius:50%;
  object-fit:cover;
  border:3px solid #fff;
  box-shadow:0 0 0 2px rgba(240,180,12,.45), 0 4px 12px rgba(20,50,80,.25);
  background:#f3f5f9;
}

/* ---------------- Closed state (blur) ---------------- */
.rates.is-closed .rate-row .sell,
.rates.is-closed .rate-row .buy{
  filter:blur(9px);
  user-select:none;pointer-events:none;
}
.closed-overlay{
  position:absolute;inset:0;z-index:5;
  display:flex;flex-direction:column;align-items:center;justify-content:center;
  gap:12px;text-align:center;padding:24px;
  background:rgba(238,241,246,.45);
  backdrop-filter:blur(1.5px);
  border-radius:var(--radius);
}
.closed-overlay .box{
  background:rgba(255,255,255,.96);
  border:1px solid var(--line);
  border-radius:18px;padding:26px 32px;
  box-shadow:0 18px 44px rgba(20,30,60,.20);
  max-width:420px;
}
.closed-overlay .lock{font-size:2.6rem;margin-bottom:8px;}
.closed-overlay h3{color:var(--red);font-size:1.5rem;font-weight:400;margin-bottom:6px;}
.closed-overlay p{color:var(--muted);font-size:1.05rem;line-height:1.7;}
.closed-overlay .when{
  margin-top:12px;font-size:.98rem;color:var(--ink);
  background:#f4f6fa;border-radius:10px;padding:8px 14px;display:inline-block;
}

/* ---------------- Contact card ---------------- */
.contact{
  margin-top:18px;border-radius:var(--radius);
  background:linear-gradient(135deg,var(--navy),var(--navy-dark));
  color:#fff;padding:18px;text-align:center;
  box-shadow:0 12px 30px rgba(20,50,80,.32);
}
.contact .owner{font-size:1.3rem;margin-bottom:10px;color:var(--gold);}
.contact .phones{display:flex;gap:10px;justify-content:center;flex-wrap:wrap;}
.contact a{
  direction:ltr;unicode-bidi:isolate;   /* keep digit groups in order */
  color:#fff;text-decoration:none;background:rgba(255,255,255,.16);
  border:1px solid rgba(255,255,255,.3);
  padding:9px 18px;border-radius:999px;
  font-size:1.1rem;font-family:system-ui,sans-serif;font-weight:600;
  transition:background .2s, transform .2s;
  display:inline-block;
}
.contact a:hover{background:rgba(255,255,255,.3);transform:translateY(-2px);}
.contact .address{
  margin-top:12px;font-size:.95rem;line-height:1.7;
  color:inherit;opacity:.9;
}

/* ---------------- Footer marquee bar ---------------- */
.footer-bar{
  position:fixed;bottom:0;left:0;right:0;z-index:60;
  background:linear-gradient(135deg,var(--navy-dark),var(--navy));
  color:#fff;
  box-shadow:0 -6px 24px rgba(0,0,0,.22);
  overflow:hidden;
  border-top:2px solid rgba(255,255,255,.18);
  /* LTR here so the wide track starts at the left edge, not off-screen */
  direction:ltr;
  height:52px;
}
.marquee{
  position:absolute;top:0;left:0;
  height:100%;display:flex;align-items:center;
  width:max-content;
  animation:marquee 17s linear infinite;   /* lower = faster */
  will-change:transform;
}
.footer-bar:hover .marquee{animation-play-state:paused;}
.marquee span{
  direction:rtl;                     /* the Kurdish text stays RTL */
  padding:0 34px;font-size:1.2rem;white-space:nowrap;
  display:inline-flex;align-items:center;gap:12px;
}
.marquee span::after{content:'\2022';opacity:.55;font-size:.75rem;}
/* Safari auto-links digit runs and styles them blue+underlined, which
   wrecks the marquee. Force the bar's own look back onto any such link. */
.footer-bar a,
.marquee a{
  color:inherit !important;
  text-decoration:none !important;
  pointer-events:none;
}

/* The content is printed twice, so shifting by exactly one copy (50% of
   the doubled track) loops seamlessly. Going from -50% to 0 carries the
   text across the bar from left to right. */
@keyframes marquee{
  from{transform:translateX(-50%);}
  to  {transform:translateX(0);}
}

/* ---------------- Responsive ---------------- */
@media(max-width:560px){
  .wrap{padding:12px 9px 24px;}
  .site-head{padding:16px 15px 14px;border-radius:18px;}
  .head-main{gap:12px;}
  .logo{width:66px;height:66px;}
  .name-ku{font-size:1.45rem;}
  .name-lat{font-size:.6rem;letter-spacing:2.5px;}
  .name-lat::after{margin-top:5px;}
  .name-en{font-size:.7rem;line-height:1.55;margin-top:5px;}
  .head-meta{margin-top:12px;padding-top:11px;gap:8px;}
  .clock .time{font-size:1.2rem;}
  .clock .date{font-size:.78rem;}
  .badge{font-size:.85rem;padding:6px 14px;}

  .row{grid-template-columns:1.5fr 1.1fr 1.1fr;gap:6px;}
  .cur-group .flag{margin-right:-22px;}
  .rate-row .cur-group .cell{padding-left:32px;}
  .rate-row .cell{font-size:1.1rem;padding:10px 4px;}
  .rate-row .cur{padding:8px 10px;border-right-width:3px;}
  .rate-row .cur .ku{font-size:1rem;}
  .rate-row .cur .code{font-size:.7rem;letter-spacing:1px;}
  .flag{width:38px;height:38px;border-width:2px;}
  .head-row .cell{font-size:.88rem;padding:8px 3px;}
  .head-row .sub{font-size:.64rem;}
  .marquee span{font-size:1rem;padding:0 22px;}
}
@media(max-width:360px){
  .name-ku{font-size:1.3rem;}
  .rate-row .cell{font-size:.95rem;}
  .rate-row .cur .ku{font-size:.9rem;}
}

/* ---------------- Reveal animation ---------------- */
.rate-row{animation:rise .5s ease both;}
@keyframes rise{from{opacity:0;transform:translateY(14px)}to{opacity:1;transform:none}}


/* ---------------- Install button + popup ---------------- */
.install-btn{
  position:absolute;top:14px;left:14px;z-index:3;
  width:40px;height:40px;border-radius:50%;
  border:1px solid rgba(240,180,12,.45);
  background:rgba(255,255,255,.08);
  color:var(--gold);font-size:1rem;cursor:pointer;
  display:flex;align-items:center;justify-content:center;
  transition:background .18s, transform .18s;
  -webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px);
  pointer-events:auto;                 /* beats the global img/logo rule */
}
.install-btn > svg{pointer-events:none;}   /* clicks land on the button */
.install-btn:hover{background:rgba(240,180,12,.22);transform:translateY(-2px);}
.install-btn:active{transform:none;}

.install-modal{
  position:fixed;inset:0;z-index:200;
  display:flex;align-items:center;justify-content:center;padding:20px;
  background:rgba(13,33,56,.55);
  -webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px);
  animation:fade .2s ease;
}
.install-modal[hidden]{display:none;}
@keyframes fade{from{opacity:0}to{opacity:1}}

.install-card{
  position:relative;width:100%;max-width:360px;text-align:center;
  background:linear-gradient(160deg,#1a3c60,var(--navy) 50%,var(--navy-dark));
  border:1px solid rgba(240,180,12,.3);
  border-radius:22px;padding:30px 24px 26px;color:#fff;
  box-shadow:0 24px 60px rgba(0,0,0,.45);
  animation:pop .25s cubic-bezier(.2,.9,.3,1.2);
}
@keyframes pop{from{opacity:0;transform:scale(.9) translateY(12px)}to{opacity:1;transform:none}}

.install-x{
  position:absolute;top:10px;left:14px;
  width:32px;height:32px;border:none;border-radius:50%;
  background:transparent;color:rgba(255,255,255,.6);
  font-size:1.6rem;line-height:1;cursor:pointer;
}
.install-x:hover{background:rgba(255,255,255,.12);color:#fff;}

.install-logo{
  width:88px;height:88px;margin:0 auto 14px;border-radius:50%;
  background:var(--logo) center/contain no-repeat;
  box-shadow:0 0 0 2px rgba(240,180,12,.5), 0 10px 26px rgba(0,0,0,.4);
}
.install-card h2{
  font-size:1.35rem;font-weight:700;color:var(--gold);
  font-family:system-ui,'Segoe UI',sans-serif;letter-spacing:1px;
}
.install-sub{font-size:1rem;color:rgba(255,255,255,.75);margin-top:2px;}
.install-text{
  font-size:.92rem;line-height:1.85;color:rgba(255,255,255,.8);
  margin:14px 0 20px;
}
.install-go{
  width:100%;padding:13px;border:none;border-radius:12px;cursor:pointer;
  background:linear-gradient(135deg,var(--gold),#d99b00);
  color:#3a2a00;font-family:inherit;font-size:1.05rem;font-weight:700;
  display:flex;align-items:center;justify-content:center;gap:9px;
  box-shadow:0 8px 20px rgba(240,180,12,.32);
  transition:transform .15s, box-shadow .15s;
}
.install-go > svg{pointer-events:none;flex:none;}
.install-go:hover:not(:disabled){transform:translateY(-2px);box-shadow:0 12px 26px rgba(240,180,12,.4);}
.install-go:disabled{opacity:.6;cursor:default;}
.install-go[hidden]{display:none;}

body.no-scroll{overflow:hidden;}

@media(max-width:560px){
  .install-btn{top:11px;left:11px;width:35px;height:35px;font-size:.9rem;}
  .install-logo{width:74px;height:74px;}
  .install-card{padding:26px 20px 22px;}
}

/* ---------------- Content protection ---------------- */
body{
  -webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;
  -webkit-touch-callout:none;                 /* no iOS long-press menu */
  -webkit-tap-highlight-color:transparent;
  touch-action:pan-x pan-y;                   /* pan is fine, pinch-zoom is not */
}
/* form fields stay usable */
input,textarea,select,[contenteditable]{
  -webkit-user-select:text;-moz-user-select:text;-ms-user-select:text;user-select:text;
}
img,.logo,.logo-img,.flag{
  -webkit-user-drag:none;user-drag:none;pointer-events:none;
}
::selection{background:transparent;}
::-moz-selection{background:transparent;}

@media print{
  body{display:none !important;}             /* nothing useful to print */
}


/* ---------------- Refresh button + overlay ---------------- */
.refresh-btn{left:62px;}
.refresh-btn:disabled{opacity:.6;cursor:default;}
.refresh-btn:hover > svg{transform:rotate(90deg);}
.refresh-btn > svg{transition:transform .3s ease;}
.refresh-overlay{
  position:fixed;inset:0;z-index:250;
  display:flex;align-items:center;justify-content:center;
  background:rgba(13,33,56,.45);
  -webkit-backdrop-filter:blur(6px);backdrop-filter:blur(6px);
  animation:fade .2s ease;
}
.refresh-overlay[hidden]{display:none;}
.refresh-box{
  display:flex;flex-direction:column;align-items:center;gap:14px;
  padding:26px 30px;border-radius:20px;
  background:linear-gradient(160deg,#1a3c60,var(--navy) 55%,var(--navy-dark));
  border:1px solid rgba(240,180,12,.3);
  box-shadow:0 20px 50px rgba(0,0,0,.4);
  animation:pop .25s cubic-bezier(.2,.9,.3,1.2);
}
.refresh-spin{
  width:46px;height:46px;border-radius:50%;
  border:4px solid rgba(255,255,255,.15);
  border-top-color:var(--gold);
  animation:spin .8s linear infinite;
}
.refresh-text{color:#fff;font-size:.95rem;}
@keyframes spin{to{transform:rotate(360deg)}}
@media (max-width:560px){ .refresh-btn{left:54px;} }
.refresh-btn.is-alone{left:14px;}
@media (max-width:560px){ .refresh-btn.is-alone{left:11px;} }

/* ---------------- Rate group titles (dollar / dinar) ---------------- */
.group-title{
  display:flex;align-items:center;gap:12px;
  margin:20px 0 10px;
}
.rates .head-row + .group-title{margin-top:6px;}
.gt-line{flex:1;height:2px;border-radius:2px;
  background:linear-gradient(90deg,transparent,rgba(240,180,12,.8));}
.gt-line:last-child{background:linear-gradient(270deg,transparent,rgba(240,180,12,.8));}
.gt-text{
  padding:0 4px;
  color:#c99400;font-weight:700;font-size:1.15rem;white-space:nowrap;
  letter-spacing:.3px;
  text-shadow:0 1px 0 rgba(255,255,255,.6), 0 2px 10px rgba(240,180,12,.25);
}
@media (max-width:560px){
  .group-title{margin:16px 0 8px;gap:8px;}
  .gt-text{font-size:1.02rem;}
}

/* "No thanks" under the install button: soft red, quiet */
.install-no{
  width:100%;margin-top:10px;padding:12px;border-radius:12px;cursor:pointer;
  border:1px solid rgba(255,120,120,.35);
  background:rgba(255,99,99,.12);color:#ffb3b3;
  font-family:inherit;font-size:.98rem;font-weight:600;
  transition:background .15s, color .15s;
}
.install-no:hover{background:rgba(255,99,99,.22);color:#ffd0d0;}
