/* =============================================================
   Reo Winter — minimalist, black & white, crafted.
   Theme colors/fonts are driven by config.js -> theme.
============================================================== */

:root {
  /* near-white paper & ink, not harsh pure black/white */
  --bg:        #fcfcfb;
  --bg-soft:   #f6f6f4;
  --line:      #e7e7e2;
  --text:      #161616;
  --muted:     #6e6e6e;
  --accent:    #161616;

  --maxw:      680px;
  --gutter:    clamp(20px, 5vw, 40px);
  --section:   clamp(48px, 8vw, 84px);

  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --font:      var(--font-sans);

  --ease: cubic-bezier(.22, .61, .36, 1);
}

html[data-mode="dark"] {
  --bg:        #0b0b0c;
  --bg-soft:   #141416;
  --line:      #242427;
  --text:      #ededed;
  --muted:     #8a8a8e;
  --accent:    #ededed;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.7;
  letter-spacing: -0.003em;
  font-feature-settings: "kern", "liga", "calt";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  transition: background .3s var(--ease), color .3s var(--ease);
}

a { color: inherit; text-decoration: none; }
img { display: block; }

[hidden] { display: none !important; }

/* accessible focus — only for keyboard users */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}
:focus:not(:focus-visible) { outline: none; }

::selection { background: var(--text); color: var(--bg); }

/* ---- scroll reveal (subtle, motion-safe) ---- */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity .7s var(--ease), transform .7s var(--ease); }
.reveal.in { opacity: 1; transform: none; }

/* ---- top bar ---- */
.bar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px var(--gutter);
  padding-left: max(var(--gutter), env(safe-area-inset-left));
  padding-right: max(var(--gutter), env(safe-area-inset-right));
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s var(--ease);
}
.bar.scrolled { border-bottom-color: var(--line); }
.bar__brand {
  font-weight: 600; letter-spacing: .01em; font-size: 15px;
  display: inline-flex; align-items: baseline; gap: 9px;
}
.bar__alias {
  font-weight: 400; font-size: 12.5px; color: var(--muted);
  letter-spacing: .02em; position: relative; padding-left: 11px;
}
.bar__alias::before {
  content: ""; position: absolute; left: 0; top: 50%;
  width: 1px; height: 11px; background: var(--line); transform: translateY(-50%);
}
@media (max-width: 460px) {
  .bar__alias { display: none; }   /* keep the bar clean on small phones */
}
.bar__toggle {
  background: none; border: none; color: var(--muted); cursor: pointer;
  font-size: 12px; letter-spacing: .12em; text-transform: uppercase;
  font-family: inherit; min-height: 44px; padding: 0 4px;
  display: inline-flex; align-items: center;
  transition: color .2s var(--ease);
}
.bar__toggle:hover { color: var(--text); }

/* ---- layout ---- */
.wrap {
  max-width: var(--maxw); margin: 0 auto;
  padding-inline: max(var(--gutter), env(safe-area-inset-left)) max(var(--gutter), env(safe-area-inset-right));
}

.block { padding: var(--section) 0; border-top: 1px solid var(--line); }
.block__title {
  font-size: 12px; letter-spacing: .18em; text-transform: uppercase;
  color: var(--muted); margin-bottom: clamp(22px, 4vw, 34px); font-weight: 500;
}

/* ---- hero ---- */
.hero {
  display: flex; gap: clamp(20px, 4vw, 36px); align-items: center;
  padding: clamp(64px, 12vw, 110px) 0 var(--section);
}
.hero__pfp { position: relative; flex-shrink: 0; }
.hero__avatar {
  width: clamp(124px, 32vw, 184px); aspect-ratio: 1;
  border-radius: 50%; overflow: hidden;
  background: var(--bg-soft); border: 1px solid var(--line);
  display: grid; place-items: center;
  font-size: clamp(38px, 9vw, 54px); font-weight: 600; color: var(--text);
  /* subtle depth ring so it catches the eye, still minimal */
  box-shadow: 0 0 0 1px var(--line), 0 18px 44px -20px rgba(0, 0, 0, .35);
  transition: transform .45s var(--ease), box-shadow .45s var(--ease);
}
.hero__pfp:hover .hero__avatar {
  transform: scale(1.02);
  box-shadow: 0 0 0 1px var(--line), 0 22px 52px -18px rgba(0, 0, 0, .45);
}
.hero__avatar img { width: 100%; height: 100%; object-fit: cover; }

/* presence dot — Discord-style, sits on the avatar corner */
.presence {
  position: absolute; right: 7%; bottom: 7%;
  width: 22%; aspect-ratio: 1; border-radius: 50%;
  background: #80848e;                      /* default / offline grey */
  box-shadow: 0 0 0 clamp(4px, 1vw, 6px) var(--bg);   /* punched ring in bg color */
}
.presence::before {                          /* cutout, painted in bg color */
  content: ""; position: absolute; display: none;
  background: var(--bg); border-radius: 50%;
}
.presence[data-state="online"]    { background: #23a55a; }
.presence[data-state="idle"]      { background: #f0b232; }
.presence[data-state="dnd"]       { background: #f23f43; }
.presence[data-state="invisible"],
.presence[data-state="offline"]   { background: #80848e; }

/* idle -> crescent moon (cutout offset to the upper-left) */
.presence[data-state="idle"]::before {
  display: block; width: 70%; height: 70%; top: -22%; left: -22%;
}
/* dnd -> horizontal bar */
.presence[data-state="dnd"]::before {
  display: block; width: 62%; height: 22%; border-radius: 3px;
  top: 50%; left: 50%; transform: translate(-50%, -50%);
}
/* invisible/offline -> hollow ring */
.presence[data-state="invisible"]::before,
.presence[data-state="offline"]::before {
  display: block; width: 44%; height: 44%;
  top: 50%; left: 50%; transform: translate(-50%, -50%);
}

/* tie the status-pill dot to the same presence color */
.status__dot { background: #80848e; }
html[data-presence="online"]    .status__dot { background: #23a55a; }
html[data-presence="idle"]      .status__dot { background: #f0b232; }
html[data-presence="dnd"]       .status__dot { background: #f23f43; }
html[data-presence="invisible"] .status__dot,
html[data-presence="offline"]   .status__dot { background: #80848e; }

.hero__facts {
  font-size: 13px; color: var(--muted); margin-top: 6px;
  letter-spacing: .01em;
}
.hero__name {
  font-family: var(--font-display);
  font-size: clamp(2.1rem, 7.2vw, 3.2rem);
  line-height: 1.04; letter-spacing: -0.02em; font-weight: 500;
  text-wrap: balance;
}
.hero__alias {
  font-size: clamp(15px, 3.4vw, 18px); color: var(--muted);
  margin-top: 4px; letter-spacing: .01em;
}
.hero__alias::before { content: "“"; opacity: .5; }
.hero__alias::after  { content: "”"; opacity: .5; }
.hero__role { color: var(--muted); font-size: 14px; margin-top: 12px; }
.status {
  display: inline-flex; align-items: flex-start; gap: 9px;
  margin-top: 16px; font-size: 14px; line-height: 1.5; color: var(--text); max-width: 100%;
}
.status > span:last-child { min-width: 0; overflow-wrap: anywhere; }
.status__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex-shrink: 0; margin-top: 7px; }

.about {
  font-family: var(--font-display);
  font-size: clamp(1.15rem, 3.4vw, 1.4rem);
  line-height: 1.55; font-weight: 400; letter-spacing: -0.01em;
  color: var(--text); max-width: 36ch; text-wrap: pretty;
}

/* ---- galleries ---- */
.gallery { display: grid; grid-template-columns: repeat(2, 1fr); gap: clamp(8px, 1.6vw, 14px); }
.gallery__item {
  position: relative; border-radius: 6px; overflow: hidden;
  border: 1px solid var(--line); cursor: zoom-in; aspect-ratio: 4/3;
  background: var(--bg-soft);
}
.gallery__item img { width: 100%; height: 100%; object-fit: cover; transition: transform .55s var(--ease), filter .35s var(--ease); }
.gallery__item:hover img { transform: scale(1.045); }
.gallery__cap {
  position: absolute; inset: auto 0 0 0;
  padding: 24px 12px 10px; font-size: 12px; letter-spacing: .01em;
  background: linear-gradient(transparent, rgba(0,0,0,.7));
  color: #fff; opacity: 0; transition: opacity .3s var(--ease);
}
.gallery__item:hover .gallery__cap, .gallery__item:focus-within .gallery__cap { opacity: 1; }
.gallery__ph { display: grid; place-items: center; height: 100%; color: var(--muted); font-size: 12px; text-align: center; padding: 8px; }

/* ---- lists (favorites) ---- */
.lists { display: grid; grid-template-columns: repeat(2, 1fr); gap: clamp(24px, 4vw, 36px) 32px; }
.list__title { font-size: 14px; font-weight: 600; margin-bottom: 14px; letter-spacing: -0.01em; }
.list__items { list-style: none; display: grid; gap: 9px; }
.list__items li { font-size: 14px; color: var(--muted); padding-left: 16px; position: relative; }
.list__items li::before { content: "—"; position: absolute; left: 0; color: var(--muted); }
.list__item--link a { color: var(--text); box-shadow: inset 0 -1px 0 var(--line); transition: box-shadow .2s var(--ease); }
.list__item--link a:hover { box-shadow: inset 0 -1px 0 var(--text); }

/* ---- certifications ---- */
.certs { display: grid; grid-template-columns: repeat(2, 1fr); gap: clamp(24px, 4vw, 32px); }
.cert__title {
  font-size: 12px; letter-spacing: .1em; text-transform: uppercase; font-weight: 600;
  margin-bottom: 14px; display: flex; align-items: center; gap: 8px;
  padding-bottom: 9px; border-bottom: 1px solid var(--line);
}
.cert__count {
  font-size: 11px; color: var(--muted); letter-spacing: 0; font-variant-numeric: tabular-nums;
  border: 1px solid var(--line); border-radius: 999px; padding: 1px 7px; font-weight: 500;
}
.cert__items { list-style: none; display: grid; gap: 8px; }
.cert__items li { font-size: 14px; color: var(--muted); padding-left: 16px; position: relative; }
.cert__items li::before { content: "›"; position: absolute; left: 0; color: var(--text); }

/* ---- projects ---- */
.cards { display: grid; }
.card { display: block; padding: 18px 0; border-bottom: 1px solid var(--line); transition: opacity .2s var(--ease); }
.cards .card:first-child { border-top: 1px solid var(--line); }
.card:hover { opacity: .55; }
.card__title { font-size: 16px; font-weight: 600; }
.card__desc { color: var(--muted); font-size: 14px; margin-top: 3px; }

/* ---- socials ---- */
.socials { display: flex; flex-wrap: wrap; gap: 14px 26px; }
.chip {
  font-size: 14px; color: var(--text); position: relative;
  padding: 6px 0; min-height: 40px; display: inline-flex; align-items: center;
}
.chip::after {
  content: ""; position: absolute; left: 0; right: 100%; bottom: 6px;
  height: 1px; background: var(--text); transition: right .28s var(--ease);
}
.chip:hover::after, .chip:focus-visible::after { right: 0; }
button.chip--copy { background: none; border: none; font: inherit; cursor: pointer; letter-spacing: inherit; }

/* ---- footer ---- */
.foot {
  margin-top: var(--section); padding: clamp(56px, 10vw, 88px) var(--gutter); text-align: center;
  padding-bottom: max(clamp(56px, 10vw, 88px), env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
}
.foot__title { font-size: 12px; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); font-weight: 500; margin-bottom: 18px; }
.foot__mail {
  font-family: var(--font-display);
  display: inline-block; font-size: clamp(1.5rem, 6vw, 2.1rem); font-weight: 500;
  box-shadow: inset 0 -1px 0 var(--text); transition: opacity .2s var(--ease);
}
.foot__mail:hover { opacity: .55; }
.foot__meta { color: var(--muted); font-size: 12px; margin-top: 28px; letter-spacing: .02em; font-variant-numeric: tabular-nums; }

/* ---- lightbox ---- */
.lightbox {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(8,8,8,.95); display: flex;
  align-items: center; justify-content: center; gap: 8px;
  padding: clamp(16px, 4vw, 32px);
  padding: max(clamp(16px,4vw,32px), env(safe-area-inset-top)) max(clamp(16px,4vw,32px), env(safe-area-inset-right)) max(clamp(16px,4vw,32px), env(safe-area-inset-bottom)) max(clamp(16px,4vw,32px), env(safe-area-inset-left));
  animation: fade .25s var(--ease);
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.lightbox__fig { display: flex; flex-direction: column; align-items: center; gap: 14px; max-width: 88vw; }
.lightbox__fig img { max-width: 88vw; max-height: 82vh; border-radius: 3px; object-fit: contain; }
.lightbox__cap { color: #e9e9e9; font-size: 13px; letter-spacing: .01em; text-align: center; }
.lightbox__nav {
  background: none; border: none; color: #fff; cursor: pointer;
  font-size: 38px; line-height: 1; padding: 14px; opacity: .55;
  min-width: 52px; min-height: 52px; flex-shrink: 0; user-select: none;
  transition: opacity .2s var(--ease);
}
.lightbox__nav:hover { opacity: 1; }
.lightbox__close {
  position: absolute; top: max(16px, env(safe-area-inset-top)); right: max(18px, env(safe-area-inset-right));
  background: none; border: none; color: #fff; cursor: pointer;
  font-size: 20px; opacity: .55; min-width: 44px; min-height: 44px; transition: opacity .2s var(--ease);
}
.lightbox__close:hover { opacity: 1; }

/* ---- responsive ---- */
@media (max-width: 620px) {
  body { font-size: 15px; }
  .hero { flex-direction: column; text-align: center; align-items: center; gap: 18px; }
  .status { margin-inline: auto; }
  .about { max-width: 100%; }
  .gallery { grid-template-columns: 1fr 1fr; }
  .lists { grid-template-columns: 1fr; }
  .certs { grid-template-columns: 1fr; }
  .socials { gap: 12px 20px; }
}
@media (max-width: 380px) {
  .gallery { grid-template-columns: 1fr; }
}

/* ---- respect reduced-motion ---- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .reveal { opacity: 1 !important; transform: none !important; }
}
