/* Abrar Khandoker — portfolio
   Frosted-glass system ported from the Home Assistant "bari" theme.
   bari's values take precedence; Apple's design language fills gaps bari is
   silent on (motion, view transitions, reveals, parallax).
   Brand: Quicksand, signal-yellow #fac832, signal-blue #32c8fa.
   Feel: bright, warm, playful. Panels neutral; bari card-category color used
   sparingly as an accent. */

/* ============================================================
   THEME TOKENS  (bari modes.dark / modes.light) — neutral, warm
   ============================================================ */
:root, [data-theme="dark"] {
  color-scheme: dark;
  --glassRGB: 236, 231, 224;
  --inkRGB: 240, 235, 228;
  --glassFillA: 0.12;
  --itemFillA: 0.07;
  --rimA: 0.42;           /* brighter frosted rim */
  --sheenHi: 0.16;        /* diagonal light sheen (bari bg3 feel) */
  --edgeHi: 0.20;         /* top highlight line */

  --page-bg:
    radial-gradient(120% 90% at 50% -10%, rgba(255, 200, 90, 0.07), transparent 60%),
    radial-gradient(90% 70% at 12% 105%, rgba(120, 150, 210, 0.05), transparent 55%),
    linear-gradient(165deg, #221e1c 0%, #1b1816 50%, #161312 100%);
  --ring: rgba(255, 205, 90, 0.06);

  --shadowCard: inset 0 -5px 10px 0 rgba(65, 60, 55, 0.20);
  --shadowItem: inset 0 -2.5px 5px 0 rgba(236, 231, 224, 0.10);
  --dropCard: 0 10px 26px rgba(8, 6, 5, 0.48);
  --dropItem: 0 4px 12px rgba(8, 6, 5, 0.30);

  --cta: rgba(240, 235, 228, 1);
  --accent-mix-color: #fff;
  --accent-mix-amt: 22%;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    color-scheme: light;
    --glassRGB: 255, 255, 255;
    --inkRGB: 58, 50, 44;
    --glassFillA: 0.45;
    --itemFillA: 0.34;
    --rimA: 0.95;
    --sheenHi: 0.55;
    --edgeHi: 0.90;
    --page-bg:
      radial-gradient(120% 95% at 50% -8%, rgba(255, 205, 110, 0.16), transparent 60%),
      radial-gradient(90% 70% at 12% 105%, rgba(120, 160, 220, 0.10), transparent 55%),
      linear-gradient(165deg, #fbf6ee 0%, #f4eee3 50%, #f6f0ea 100%);
    --ring: rgba(170, 140, 80, 0.08);
    --shadowCard: inset 0 -4px 9px 0 rgba(195, 170, 115, 0.14);
    --shadowItem: inset 0 -2px 4px 0 rgba(195, 170, 115, 0.12);
    --dropCard: 0 12px 30px rgba(165, 135, 85, 0.20);
    --dropItem: 0 4px 12px rgba(165, 135, 85, 0.14);
    --cta: #101010;
    --accent-mix-color: #000;
    --accent-mix-amt: 28%;
  }
}

[data-theme="light"] {
  color-scheme: light;
  --glassRGB: 255, 255, 255;
  --inkRGB: 58, 50, 44;
  --glassFillA: 0.45;
  --itemFillA: 0.34;
  --rimA: 0.95;
  --sheenHi: 0.55;
  --edgeHi: 0.90;
  --page-bg:
    radial-gradient(120% 95% at 50% -8%, rgba(255, 205, 110, 0.16), transparent 60%),
    radial-gradient(90% 70% at 12% 105%, rgba(120, 160, 220, 0.10), transparent 55%),
    linear-gradient(165deg, #fbf6ee 0%, #f4eee3 50%, #f6f0ea 100%);
  --ring: rgba(170, 140, 80, 0.08);
  --shadowCard: inset 0 -4px 9px 0 rgba(195, 170, 115, 0.14);
  --shadowItem: inset 0 -2px 4px 0 rgba(195, 170, 115, 0.12);
  --dropCard: 0 12px 30px rgba(165, 135, 85, 0.20);
  --dropItem: 0 4px 12px rgba(165, 135, 85, 0.14);
  --cta: #101010;
  --accent-mix-color: #000;
  --accent-mix-amt: 28%;
}

/* ============================================================
   STATIC TOKENS
   ============================================================ */
:root {
  --yellow: #fac832;
  --blue: #32c8fa;

  /* nudged past bari's blur(10) to restore the frosted look on bright bg */
  --filterCard: blur(16px) saturate(170%);
  --filterItem: blur(12px) saturate(150%);
  --filterEdge: blur(26px) saturate(200%);

  --radiusOuter: 12.5px;
  --radiusInner: 7.5px;
  --radiusEdges: 11.5px;
  --radiusPill: 5em;
  --paddingCard: 25px;
  --paddingItem: 12.5px;
  --paddingHost: 1px;

  --spring: cubic-bezier(0.34, 1.4, 0.5, 1);

  --h1-size: 3rem;    --h1-weight: 300; --h1-height: 1.125;
  --h2-size: 1.5rem;  --h2-weight: 500; --h2-height: 1.125;
  --h3-size: 1.5rem;  --h3-weight: 900; --h3-height: 1.125;
  --h4-size: 1.25rem; --h4-weight: 700; --h4-height: 1.125;
  --h5-size: 1.25rem; --h5-weight: 500; --h5-height: 1.25;

  --ink: rgba(var(--inkRGB), 1);
  --ink-soft: rgba(var(--inkRGB), 0.78);
  --ink-faint: rgba(var(--inkRGB), 0.55);

  --accent: var(--yellow);
  --link-underline: var(--blue);
  --maxw: 66rem;
}

/* ============================================================
   CATEGORY COLORS  (bari card-category palettes)
   ============================================================ */
.cat-weather  { --cat: 75, 200, 225; }
.cat-media    { --cat: 200, 125, 225; }
.cat-fan      { --cat: 100, 225, 175; }
.cat-cool     { --cat: 25, 150, 250; }
.cat-electric { --cat: 255, 200, 0; }
.cat-water    { --cat: 0, 25, 200; }
.cat-lighting { --cat: 250, 200, 0; }
.cat-warning  { --cat: 255, 175, 0; }
.cat-heat     { --cat: 250, 80, 50; }
.cat-prayer   { --cat: 75, 125, 50; }
.cat-cleaning { --cat: 255, 125, 200; }
.cat-security { --cat: 250, 150, 25; }

[class*="cat-"] {
  --accent: color-mix(in srgb, rgb(var(--cat)), var(--accent-mix-color) var(--accent-mix-amt));
  --link-underline: rgb(var(--cat));
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0; min-height: 100vh;
  color: var(--ink);
  font-family: 'Quicksand', system-ui, Arial, sans-serif;
  font-weight: 300;
  font-size: 17px; line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  background: var(--page-bg);
  background-attachment: fixed;
}
/* two ring clusters give the frosted glass something to refract */
body::before {
  content: ""; position: fixed; inset: -12% 0; z-index: -1; pointer-events: none;
  background:
    repeating-radial-gradient(circle at 50% 2%, transparent 0 38px, var(--ring) 38px 39px),
    repeating-radial-gradient(circle at 88% 78%, transparent 0 30px, var(--ring) 30px 31px);
  -webkit-mask: radial-gradient(circle at 50% 5%, #000, transparent 72%),
                radial-gradient(circle at 88% 78%, #000, transparent 45%);
          mask: radial-gradient(circle at 50% 5%, #000, transparent 72%),
                radial-gradient(circle at 88% 78%, #000, transparent 45%);
  transform: translateY(calc(var(--sy, 0) * 0.05px));
  will-change: transform;
}

a { color: var(--ink); text-decoration: none; transition: color 0.15s ease; }
a:hover { color: var(--blue); }
h1, h2, h3 { margin: 0; line-height: var(--h2-height); }
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 1.5rem; }

/* ============================================================
   GLASS UTILITIES — neutral fill + sheen + bright rim + top edge
   ============================================================ */
.glass, .glass-item, .chip {
  position: relative; isolation: isolate;
  -webkit-backdrop-filter: var(--filterCard);
          backdrop-filter: var(--filterCard);
  border-radius: var(--radiusOuter);
  background:
    linear-gradient(150deg, rgba(var(--glassRGB), var(--sheenHi)), rgba(var(--glassRGB), 0) 52%),
    rgba(var(--glassRGB), var(--glassFillA));
  box-shadow: inset 0 1.5px 0 -0.5px rgba(var(--glassRGB), var(--edgeHi)),
              var(--shadowCard), var(--dropCard);
}
.glass-item, .chip {
  border-radius: var(--radiusInner);
  -webkit-backdrop-filter: var(--filterItem);
          backdrop-filter: var(--filterItem);
  background:
    linear-gradient(150deg, rgba(var(--glassRGB), var(--sheenHi)), rgba(var(--glassRGB), 0) 52%),
    rgba(var(--glassRGB), var(--itemFillA));
  box-shadow: inset 0 1px 0 -0.5px rgba(var(--glassRGB), var(--edgeHi)),
              var(--shadowItem), var(--dropItem);
}
.glass::before, .glass-item::before, .chip::before {
  content: ""; position: absolute; inset: 0; z-index: 2;
  border-radius: inherit; padding: var(--paddingHost);
  background: rgba(var(--glassRGB), var(--rimA));
  -webkit-backdrop-filter: var(--filterEdge);
          backdrop-filter: var(--filterEdge);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
          mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  pointer-events: none; transition: background 0.2s var(--spring);
}
.chip::before { -webkit-backdrop-filter: none; backdrop-filter: none; }

@supports not ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .glass, .glass-item, .chip { background: rgba(var(--glassRGB), 0.95); }
}

/* ---------- pill chip bar (bari "chips" template) ---------- */
.topbar { position: sticky; top: 0; z-index: 50; padding: 0.9rem 0; }
/* the whole bar is ONE long floating glass pill (all widths) */
.topbar .bar {
  position: relative; isolation: isolate;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  border-radius: var(--radiusPill);
  padding: 0.4rem 0.6rem;
  -webkit-backdrop-filter: var(--filterCard);
          backdrop-filter: var(--filterCard);
  background:
    linear-gradient(150deg, rgba(var(--glassRGB), var(--sheenHi)), rgba(var(--glassRGB), 0) 52%),
    rgba(var(--glassRGB), var(--glassFillA));
  box-shadow: inset 0 1.5px 0 -0.5px rgba(var(--glassRGB), var(--edgeHi)),
              var(--shadowCard), var(--dropCard);
}
.topbar .bar::before {
  content: ""; position: absolute; inset: 0; z-index: 2;
  border-radius: inherit; padding: var(--paddingHost);
  background: rgba(var(--glassRGB), var(--rimA));
  -webkit-backdrop-filter: var(--filterEdge);
          backdrop-filter: var(--filterEdge);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
          mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  pointer-events: none;
}
.pill { display: inline-flex; align-items: center; gap: 0.6rem; padding: 0.5rem 1.1rem; border-radius: var(--radiusPill); font-weight: var(--h5-weight); font-size: 1rem; color: var(--ink); transition: color 0.15s ease; }
/* inner items are plain text inside the single bar — no individual glass */
.topbar .pill { background: none; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
.topbar .pill::before { display: none; }
.topbar .pill:hover { color: var(--blue); }
.brand img { width: 1.9rem; height: 1.9rem; display: block; }
.brand .name { font-weight: 700; letter-spacing: 0.01em; }
.nav { display: flex; align-items: center; gap: 0.25rem; }
.nav .pill { font-size: 0.95rem; }
.nav .pill.active { color: var(--blue); }
.theme-toggle { cursor: pointer; border: 0; font-family: inherit; line-height: 1; padding: 0.5rem 0.7rem; }
.theme-toggle .i { width: 1.15rem; height: 1.15rem; display: none; }
.theme-toggle[data-eff="dark"] .i-sun { display: block; }
.theme-toggle[data-eff="light"] .i-moon { display: block; }

/* ---------- hero ---------- */
.hero { padding: 3.25rem 0 1.75rem; }
.hero .eyebrow { font-weight: 500; font-size: 0.8rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--accent); margin-bottom: 1rem; }
.hero h1 { font-size: clamp(2.3rem, 6vw, var(--h1-size)); font-weight: var(--h1-weight); line-height: var(--h1-height); }
.hero .lede { font-size: clamp(1.05rem, 2.2vw, 1.3rem); font-weight: 300; color: var(--ink-soft); margin: 0; }
.hero-panel { margin-top: 1.6rem; max-width: 48rem; padding: 1.6rem 1.8rem; border-top: 4px solid var(--accent); }

/* ---------- home: featured section + CTA button ---------- */
.home-featured { padding-top: 0.5rem; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.section-head h2 { font-size: var(--h4-size); font-weight: var(--h4-weight); display: inline-block; padding-bottom: 0.3rem; border-bottom: 4px solid var(--accent); }
.seeall { text-align: center; margin-top: 2rem; }
.btn { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.7rem 1.5rem; border-radius: var(--radiusPill); font-weight: 700; font-size: 1rem; color: var(--cta); transition: transform 0.2s var(--spring), color 0.15s ease; }
.btn::before { border-radius: var(--radiusPill); }
.btn:hover { transform: translateY(-2px); color: var(--blue); }

/* ---------- collapsible filter bar ---------- */
.filterbar { display: flex; flex-direction: column; gap: 0.7rem; padding: 1.25rem 0 0.25rem; }
.filtergroup { padding: 0; overflow: hidden; }
.filtergroup summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 0.5rem; padding: 0.75rem 1.15rem; font-weight: 600; font-size: 0.78rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-soft); }
.filtergroup summary::-webkit-details-marker { display: none; }
.filtergroup summary::after { content: "\203A"; margin-left: auto; transform: rotate(90deg); transition: transform 0.2s var(--spring); font-size: 1.2rem; color: var(--ink-faint); }
.filtergroup[open] summary::after { transform: rotate(-90deg); }
.fcount { font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--ink-faint); font-size: 0.85rem; }
.fpills { display: flex; flex-wrap: wrap; gap: 0.5rem; padding: 0 1.15rem 1rem; }
.fpill { cursor: pointer; border: 0; font-family: inherit; font-size: 0.82rem; font-weight: 500; color: var(--ink); padding: 0.35rem 0.85rem; border-radius: var(--radiusPill); transition: transform 0.18s var(--spring), color 0.15s ease; }
.fpill:hover { transform: translateY(-2px); }
.fpill.active { color: var(--blue); font-weight: 700; box-shadow: inset 0 0 0 2px var(--blue), var(--shadowItem); }
.filtermeta { font-size: 0.85rem; color: var(--ink-faint); padding-left: 0.2rem; }

/* ---------- index: project grid ---------- */
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.4rem; padding: 1.25rem 0 3rem; scroll-margin-top: 5.5rem; }
@media (max-width: 760px) { .grid { grid-template-columns: 1fr; } }
.card { display: flex; flex-direction: column; padding: var(--paddingCard); color: inherit; transition: transform 0.22s var(--spring), box-shadow 0.22s var(--spring); }
.card.hide { display: none; }
.card:hover { transform: translateY(-5px); }
.card:hover::before { background: var(--accent); }
.card .kicker { font-size: 0.78rem; font-weight: 500; letter-spacing: 0.13em; text-transform: uppercase; color: var(--accent); margin-bottom: 0.5rem; }
.card h3 { font-size: var(--h2-size); font-weight: var(--h2-weight); margin-bottom: 0.6rem; }
.card p { margin: 0 0 1.2rem; color: var(--ink-soft); font-size: 0.98rem; }
.card .stats { display: flex; gap: 1.6rem; margin: auto 0 1.1rem; }
.card .stats .stat .n { font-weight: var(--h3-weight); font-size: 1.3rem; color: var(--accent); }
.card .stats .stat .l { font-size: 0.72rem; color: var(--ink-faint); line-height: 1.25; }
.more { color: var(--cta); font-weight: 700; text-decoration: underline; text-decoration-color: var(--link-underline); text-decoration-thickness: 2px; text-underline-offset: 3px; }
.card:hover .more { text-decoration-thickness: 3px; }

/* ---------- project page ---------- */
.proj-meta { font-weight: 500; font-size: 0.95rem; color: var(--ink-faint); margin-bottom: 1rem; }
.section { padding: 0.9rem 0; }
.panel { padding: 1.8rem 2rem; }
.section h2 { font-size: var(--h4-size); font-weight: var(--h4-weight); margin: 0 0 1.2rem; display: inline-block; padding-bottom: 0.3rem; border-bottom: 4px solid var(--accent); }
.section .hint { font-size: 0.82rem; color: var(--ink-faint); margin: 0 0 1rem; }
.section p { max-width: 52rem; margin: 0 0 1rem; color: var(--ink-soft); }
.section p:last-child { margin-bottom: 0; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: 1rem; margin-bottom: 1.6rem; }
.stat-card { padding: 1.2rem 1.1rem 1.2rem 1.25rem; border-left: 3px solid var(--accent); transition: transform 0.2s var(--spring); }
.stat-card:hover { transform: translateY(-3px); }
.stat-card .n { font-weight: var(--h3-weight); font-size: 1.85rem; line-height: 1; color: var(--accent); }
.stat-card .l { font-size: 0.85rem; color: var(--ink-faint); margin-top: 0.5rem; }
ul.impact { margin: 0; padding-left: 1.1rem; max-width: 52rem; color: var(--ink-soft); }
ul.impact li { margin-bottom: 0.6rem; }
ul.impact li::marker { color: var(--accent); }

/* chips */
.chips { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.chip { font-size: 0.85rem; font-weight: 500; padding: 0.45rem 0.95rem; color: var(--ink); border-radius: var(--radiusPill); transition: transform 0.18s var(--spring), color 0.15s ease; }
a.chip:hover { transform: translateY(-2px); color: var(--blue); }
.chip::before { border-radius: var(--radiusPill); }
.chip.tool { font-weight: 400; color: var(--ink-soft); }

.backlink { display: inline-block; margin-top: 1.6rem; font-weight: 600; }
.backlink::before { content: "\2190"; margin-right: 0.4rem; color: var(--accent); }

/* ---------- about / summary ---------- */
.about .panel { margin-bottom: 1.4rem; }
.about h2 { font-size: var(--h4-size); font-weight: var(--h4-weight); margin: 0 0 1rem; display: inline-block; padding-bottom: 0.3rem; border-bottom: 4px solid var(--accent); }
.about p { color: var(--ink-soft); max-width: 52rem; margin: 0 0 1rem; }
.about p:last-child { margin-bottom: 0; }
.placeholder { font-style: italic; opacity: 0.75; }

/* ---------- footer ---------- */
.site-footer { margin: 3rem 0; padding: 2.2rem; text-align: center; }
.site-footer .contact a { font-weight: 600; }
.site-footer .tagline { margin-top: 1.3rem; display: flex; justify-content: center; flex-wrap: wrap; gap: 1.5rem; font-style: italic; color: var(--ink-faint); font-size: 0.95rem; }
.site-footer .copyright { margin-top: 1.2rem; font-size: 0.8rem; color: var(--ink-faint); }

/* ============================================================
   MOTION (Apple gap-fill)
   ============================================================ */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 0.35s; }

.js .reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.55s var(--spring), transform 0.55s var(--spring); }
.js .reveal.in { opacity: 1; transform: none; }

/* ============================================================
   MOBILE HEADER — collapse the separate pills into one long pill
   ============================================================ */
@media (max-width: 700px) {
  .brand .name { display: none; }
  .topbar .wrap { padding: 0 0.9rem; }
  .topbar .bar { gap: 0.1rem; padding: 0.28rem 0.4rem; }
  .topbar .pill { padding: 0.35rem 0.4rem; font-size: 0.82rem; white-space: nowrap; }
  .topbar .brand img { width: 1.55rem; height: 1.55rem; }
  .topbar .nav { gap: 0; }
  .topbar .theme-toggle { padding: 0.35rem; }
  .topbar .theme-toggle .i { width: 1rem; height: 1rem; }
  /* keep the tagline trio on a single row */
  .site-footer { padding: 2rem 1rem; }
  .site-footer .tagline { flex-wrap: nowrap; gap: 0.5rem; font-size: clamp(0.62rem, 2.9vw, 0.95rem); }
  .site-footer .tagline span { white-space: nowrap; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
  body::before { transform: none !important; }
  .card:hover, .stat-card:hover, .pill:hover, .chip:hover, .fpill:hover, a.chip:hover, .btn:hover { transform: none; }
  .js .reveal { opacity: 1; transform: none; }
  ::view-transition-old(root), ::view-transition-new(root) { animation: none; }
}
