/* y3f.me: a night at the fire, then a few quiet pages of notes about me. */

:root {
  --night: #0b0a0c;
  --ink: #ede5d8;
  --mist: #a8a097;
  --faint: #8f877e;
  --ember: #eaa771;
  --line: rgba(237, 229, 216, 0.10);
  --surface-4: #201c23;
  --shadow-layer:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    inset 0 -1px 0 rgba(0, 0, 0, 0.55),
    0 2px 3px rgba(0, 0, 0, 0.55),
    0 14px 30px rgba(0, 0, 0, 0.32),
    0 30px 70px rgba(0, 0, 0, 0.22);
  --shadow-raised:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    inset 0 -2px 4px rgba(0, 0, 0, 0.45),
    0 2px 3px rgba(0, 0, 0, 0.6),
    0 12px 24px rgba(0, 0, 0, 0.35);
  --radius: 22px;
  --display: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --body: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  /* Never inside a phone's notch or rounded corners in landscape. */
  --gutter: max(clamp(20px, 6vw, 72px), env(safe-area-inset-left), env(safe-area-inset-right));
  /* The cards' column. --edge is where its side sits, for the hero words too. */
  --block: 44rem;
  --edge: max(var(--gutter), (100% - var(--block)) / 2);
  color-scheme: dark;
}

* { box-sizing: border-box; }
.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
html { background: var(--night); scroll-behavior: smooth; }
body {
  margin: 0;
  background-color: var(--night);
  background-image:
    radial-gradient(ellipse 80% 45% at 50% 100%, rgba(234, 167, 113, 0.06), transparent 70%),
    linear-gradient(180deg, var(--night) 0%, var(--night) 100svh, #100d12 116svh, #151218 100%);
  background-repeat: no-repeat;
  color: var(--ink);
  font: 400 1rem/1.65 var(--body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

a { color: var(--ember); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.3em; }
a:hover { color: var(--ink); }
a:focus-visible { outline: 2px solid var(--ember); outline-offset: 4px; border-radius: 2px; }
.nowrap { white-space: nowrap; }

/* ─── The hero: the night at the fire ─── */

.hero {
  position: relative;
  height: 100svh;
  min-height: 320px;
  overflow: hidden;
  isolation: isolate;
}
.hero-fallback, .hero-still, .hero-sky {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
/* The land sits at the bottom, anchored to the right where the fire is so sideways
   cropping takes from the empty left sand: the same placement the GPU uses. */
.hero-fallback, .hero-still {
  background-size: cover;
  background-position: 100% 100%;
}
.hero-fallback {
  z-index: -3;
  filter: blur(14px);
  transform: scale(1.06);
  transform-origin: 50% 100%;
}
.is-live .hero-fallback { visibility: hidden; transition: visibility 0s 1.6s; }
/* The still is the default hero, one picture for each screen shape. The live canvas
   fades in over it only after its first frame, so phones without WebGPU, and any
   browser where the module fails, still get the finished picture instead of the
   blurred preview. */
.hero-still {
  z-index: -2;
  display: block;
  opacity: 1;
  background-image: url(still-wide.webp);
  transition: opacity 1.2s ease;
}
@media (max-aspect-ratio: 1/1) { .hero-still { background-image: url(still-tab.webp); } }
@media (max-aspect-ratio: 13/20) { .hero-still { background-image: url(still-phone.webp); } }
@media (max-aspect-ratio: 1/2) { .hero-still { background-image: url(still-tall.webp); } }
.is-live .hero-still { opacity: 0; }
.no-gpu .hero-still { display: block; opacity: 1; }
.hero-sky {
  z-index: -1;
  touch-action: pan-y;
  opacity: 0;
  transition: opacity 1.6s ease;
}
.is-live .hero-sky { opacity: 1; }
/* The sand fades into the night below, where the page carries on. */
.hero::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 14svh;
  background: linear-gradient(to bottom, rgba(11, 10, 12, 0), var(--night));
  pointer-events: none;
}

.hero-text {
  position: absolute;
  z-index: 1;
  inset-inline: var(--edge) var(--gutter);
  bottom: calc(15svh + env(safe-area-inset-bottom));
  pointer-events: none;
  /* The words come in once, softly, as the night settles. */
  animation: arrive 1.4s ease 0.4s both;
}
/* (Not quite 0: browsers only count what's painted, and the name should count as painted.) */
@keyframes arrive { from { opacity: 0.01; transform: translateY(8px); } }
.hero-name {
  margin: 0;
  font: 600 clamp(2.4rem, 11vw, 4.4rem)/1 var(--display);
  letter-spacing: -0.015em;
  color: var(--ink);
  text-shadow: 0 0 40px rgba(11, 10, 12, 0.9), 0 2px 18px rgba(11, 10, 12, 0.6);
}
.hero-line {
  margin: 0.45rem 0 0;
  padding-left: 0.55em;
  font-size: clamp(0.95rem, 2.8vw, 1.15rem);
  font-weight: 400;
  letter-spacing: 0.04em;
  color: rgba(237, 229, 216, 0.84);
  text-shadow: 0 0 14px var(--night), 0 0 6px var(--night);
}
/* Wide screens: the words lie on the empty sand on the left, clear of the fire on the right.
   Tall screens: the fire fills the bottom, so the words sit up in the sky. */
@media (min-aspect-ratio: 1/1) {
  /* Large screens: the name sits at the fire's level, on the open sand on the left. */
  .hero-text {
    bottom: calc(8.5svh + env(safe-area-inset-bottom));
    inset-inline: var(--edge) 38vw;
    text-align: left;
  }
  .hero-name {
    font-size: clamp(2.8rem, 5.2vw, 5.1rem);
    white-space: nowrap;
  }
}
@media (min-aspect-ratio: 1/1) and (min-width: 80em) {
  /* Align the name's left edge with the 60vw content column's left edge (20vw from left),
     and the crescent moon above it. */
  .hero-text {
    inset-inline-start: 20vw;
    inset-inline-end: 36vw;
  }
}
@media (max-aspect-ratio: 1/1) {
  .hero-text { bottom: auto; top: calc(22svh + env(safe-area-inset-top)); }
}
/* Short screens (landscape phones, big zoom): the hero grows with its words instead of
   clipping them or stacking them on each other. */
@media (max-height: 500px) {
  .hero {
    height: auto;
    min-height: max(100svh, 320px);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 3rem var(--gutter) calc(0.75rem + env(safe-area-inset-bottom));
  }
  .hero-text { position: relative; inset: auto; max-width: none; text-align: left; transform: none; }
}

/* ─── The page: carved headers, cards below ─── */

.page {
  width: min(var(--block), 100% - 2 * var(--gutter));
  margin-inline: auto;
  padding-block: 3.5rem 1rem;
}

.group { margin-bottom: 2.6rem; }

.group-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  padding: 0 0 0.8rem;
}

/* The heading is cut into the page, not raised on a card. */
.group-head h2,
.group-tag {
  margin: 0;
  font: 600 clamp(1.75rem, 4.2vw, 2.25rem)/1.2 var(--display);
  letter-spacing: -0.01em;
  color: #6a626e;
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.10),
    0 -1px 2px rgba(0, 0, 0, 0.9);
}

.cards {
  display: grid;
  gap: 0.9rem;
}

/* Every card carries the contact layer's warm glow, a light top edge and a deep
   bottom shadow, so it reads as a raised 3D surface against the page. */
.card {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 50% -20%, rgba(234, 167, 113, 0.10), transparent 60%),
    linear-gradient(180deg, #2b2630 0%, var(--surface-4) 46%, #19161c 100%);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: var(--radius);
  box-shadow: var(--shadow-layer);
}
.card > * { position: relative; z-index: 1; }
/* Only the About card carries the two low-ember quotation marks. */
.intro-card::before, .intro-card::after {
  position: absolute;
  z-index: 0;
  color: rgba(234, 167, 113, 0.09);
  font: 600 var(--quote-size, clamp(5rem, 9vw, 8.5rem))/1 var(--display);
  pointer-events: none;
  user-select: none;
}
.intro-card::before { content: "“"; inset-inline-start: 0.35rem; top: -0.55rem; }
.intro-card::after { content: "”"; inset-inline-end: 0.5rem; bottom: -2.9rem; }

a.card {
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}
a.card:hover {
  transform: translateY(-3px);
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    inset 0 -1px 0 rgba(0, 0, 0, 0.6),
    0 3px 5px rgba(0, 0, 0, 0.55),
    0 22px 44px rgba(0, 0, 0, 0.42),
    0 42px 80px rgba(0, 0, 0, 0.28);
}
a.card:active {
  transform: translateY(1px);
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.45), 0 1px 2px rgba(0, 0, 0, 0.55);
}
a.card:focus-visible { outline: 2px solid var(--ember); outline-offset: -3px; }

/* The short intro above the work: a warm card with two quiet quotation marks. */
.intro-card {
  --quote-size: clamp(5rem, 9vw, 8.5rem);
  padding: 4.5rem 2.6rem;
}
.intro-line {
  position: relative;
  margin: 0;
  color: var(--ink);
  font: 500 clamp(1.3rem, 2.4vw, 1.55rem)/1.65 var(--display);
  letter-spacing: 0.005em;
  text-wrap: pretty;
}

.item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 1rem;
  padding: 1.35rem 1.5rem 1.4rem;
  color: var(--ink);
  text-decoration: none;
}
.item-main { display: flex; align-items: flex-start; gap: 1rem; min-width: 0; }
.item-text { display: grid; gap: 0.3rem; min-width: 0; }
.item-title { font-weight: 600; font-size: 1.12rem; line-height: 1.4; letter-spacing: -0.01em; }
.item-meta { color: var(--mist); font-size: 0.94rem; line-height: 1.6; text-wrap: pretty; }

.stats {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 1rem;
  margin-top: 0.7rem;
  color: var(--mist);
  font-size: 0.86rem;
  line-height: 1.5;
}
.stat {
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
  white-space: nowrap;
  color: var(--mist);
  font-weight: 500;
}
.stat svg { width: 0.9rem; height: 0.9rem; opacity: 0.72; }
.stat-commits { color: var(--faint); }

.lang-dot { width: 0.45rem; height: 0.45rem; border-radius: 50%; display: inline-block; flex: none; }
.lang-html { background: #e34f26; }
.lang-css { background: #8b5cf6; }
.lang-js { background: #f7df1e; }
.lang-py { background: #3776ab; }
.lang-ts { background: #3178c6; }
.lang-rn { background: #61dafb; }
.lang-kotlin { background: #7f52ff; }
.lang-swift { background: #f05138; }

.badge {
  flex: none;
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 0.75rem;
  overflow: hidden;
}
.badge img { width: 100%; height: 100%; object-fit: cover; }
.badge-glyph {
  color: var(--ember);
  background:
    radial-gradient(ellipse at 50% 0%, rgba(234, 167, 113, 0.14), transparent 65%),
    linear-gradient(180deg, #302a35, #201c25);
  border: 1px solid rgba(255, 255, 255, 0.10);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.10), 0 4px 10px rgba(0, 0, 0, 0.3);
}
.cert-card .badge { width: 4rem; height: 4rem; border-radius: 0.9rem; }

.go {
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  margin-top: 0.2rem;
  border-radius: 50%;
  color: var(--faint);
  transition: color 0.18s, background-color 0.18s, transform 0.18s;
}
.item:hover .go { color: var(--ink); background: rgba(255, 255, 255, 0.06); transform: translateX(2px); }

/* Apps: a wider card with the icon and copy on top, facts and stores below. */
.app-card { padding: 1.5rem 1.6rem 1.35rem; }
.app-top { display: flex; align-items: flex-start; gap: 1rem; }
.app-icon {
  flex: none;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 0.9rem;
  overflow: hidden;
  background: #141216;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 10px 22px rgba(0, 0, 0, 0.38);
}
.app-icon img { display: block; width: 100%; height: 100%; object-fit: cover; }
.app-info { display: grid; gap: 0.3rem; min-width: 0; }
.app-title-row { display: flex; align-items: baseline; flex-wrap: wrap; gap: 0.2rem 0.65rem; }
.app-name { margin: 0; font: 600 1.2rem/1.35 var(--body); letter-spacing: -0.01em; }
.app-name-en { color: var(--faint); font-size: 0.86rem; font-weight: 500; letter-spacing: 0.01em; }
.app-desc { margin: 0; color: var(--mist); font-size: 0.94rem; line-height: 1.6; text-wrap: pretty; }
.app-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.7rem 1.1rem;
  margin-top: 1.15rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.app-metrics { display: flex; flex-wrap: wrap; align-items: center; gap: 0.55rem 1.1rem; }
.metric { display: inline-flex; align-items: center; gap: 0.38rem; color: var(--mist); font-size: 0.86rem; }
.metric svg { opacity: 0.7; }
.app-tech { display: flex; flex-wrap: wrap; align-items: center; gap: 0.45rem 0.9rem; font-size: 0.8rem; }
.tech { display: inline-flex; align-items: center; gap: 0.38rem; color: var(--mist); font-weight: 500; white-space: nowrap; }

.rating { display: inline-flex; align-items: center; gap: 0.4rem; }
.rating-stars { position: relative; width: 4.86rem; height: 0.92rem; flex: none; direction: ltr; }
.rating-base, .rating-fill { position: absolute; inset: 0 auto 0 0; display: flex; gap: 0.09rem; }
.rating-fill { overflow: hidden; }
.star { width: 0.9rem; height: 0.9rem; flex: none; }
.rating-base .star { fill: rgba(237, 229, 216, 0.16); }
.rating-fill .star { fill: var(--ember); }
.rating-value { color: var(--ink); font-size: 0.9rem; font-weight: 600; }
.rating-count { color: var(--faint); font-size: 0.78rem; white-space: nowrap; }

.app-stores { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-inline-start: auto; }
.store-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.48rem 0.8rem;
  border-radius: 999px;
  background-color: #2c2731;
  background-image: linear-gradient(180deg, #3a3440 0%, #29242d 55%, #211d25 100%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    inset 0 -2px 4px rgba(0, 0, 0, 0.35),
    0 2px 3px rgba(0, 0, 0, 0.45),
    0 8px 16px rgba(0, 0, 0, 0.25);
  color: var(--ink);
  text-decoration: none;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.store-btn svg { color: var(--ember); }
.store-btn:hover {
  transform: translateY(-2px);
  border-color: rgba(234, 167, 113, 0.34);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    inset 0 -2px 4px rgba(0, 0, 0, 0.4),
    0 3px 5px rgba(0, 0, 0, 0.5),
    0 12px 24px rgba(0, 0, 0, 0.32);
}
.store-btn:active {
  transform: translateY(1px);
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.45), 0 1px 2px rgba(0, 0, 0, 0.5);
}
.store-btn:focus-visible { outline: 2px solid var(--ember); outline-offset: 3px; }

/* Contact: the last card, same warm surface, with one big door. */
.contact-card {
  padding: 2.2rem 1.5rem 2.4rem;
  text-align: center;
}
.contact-lede {
  margin: 0 0 1.3rem;
  color: var(--mist);
  font-size: 1.05rem;
  line-height: 1.6;
  text-wrap: balance;
}
.email {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.85rem 1.3rem;
  border-radius: 999px;
  background-color: #302a35;
  background-image: linear-gradient(180deg, #3a3440 0%, #2a252e 55%, #211d25 100%);
  border: 1px solid rgba(255, 255, 255, 0.13);
  box-shadow: var(--shadow-raised);
  color: var(--ink);
  text-decoration: none;
  font: 600 clamp(1.15rem, 3.5vw, 1.6rem)/1.2 var(--body);
  direction: ltr;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.email:hover {
  transform: translateY(-2px);
  border-color: rgba(234, 167, 113, 0.40);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    inset 0 -2px 4px rgba(0, 0, 0, 0.45),
    0 3px 5px rgba(0, 0, 0, 0.6),
    0 18px 38px rgba(0, 0, 0, 0.45);
}
.email:active {
  transform: translateY(1px);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.5), 0 1px 2px rgba(0, 0, 0, 0.55);
}
.email:focus-visible { outline: 2px solid var(--ember); outline-offset: 4px; }
.email svg { width: 1.1em; height: 1.1em; color: var(--ember); }

.foot {
  width: min(var(--block), 100% - 2 * var(--gutter));
  margin-inline: auto;
  padding-block: 2rem calc(2.5rem + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 0.8rem;
  text-align: center;
}
.foot p { margin: 0; }

/* Phones: the card keeps its shape, the rows get a little tighter. */
@media (max-width: 30em) {
  .group-head { padding-bottom: 0.65rem; }
  .card { border-radius: 18px; }
  .item { grid-template-columns: minmax(0, 1fr); padding: 1.15rem 1.15rem 1.2rem; gap: 0.5rem; }
  .item-main { gap: 0.8rem; }
  .badge { width: 2.4rem; height: 2.4rem; border-radius: 0.65rem; }
  .cert-card .badge { width: 3.5rem; height: 3.5rem; }
  .cert-card .item-title { font-size: 1.02rem; line-height: 1.45; }
  .item-title { font-size: 1.05rem; }
  .go { display: none; }
  .item-meta { font-size: 0.92rem; }
  .stats { gap: 0.3rem 0.8rem; font-size: 0.82rem; }
  .app-card { padding: 1.2rem 1.15rem 1.15rem; }
  .app-top { gap: 0.8rem; }
  .app-icon { width: 3rem; height: 3rem; border-radius: 0.8rem; }
  .app-name { font-size: 1.12rem; }
  .app-desc { font-size: 0.92rem; }
  .app-foot { gap: 0.65rem 0.8rem; margin-top: 1rem; padding-top: 0.9rem; }
  .app-stores { margin-inline-start: 0; }
  .store-btn { padding: 0.45rem 0.7rem; }
  .intro-card { --quote-size: 4.5rem; padding: 3.4rem 1.6rem; }
  .intro-line { font-size: 1.25rem; }
  .contact-lede { font-size: 0.98rem; }
  .contact-card { padding: 2rem 1.2rem 2.2rem; }
}

/* Tablets and up: a little more air. */
@media (min-width: 48em) {
  .group { margin-bottom: 3rem; }
  .item { padding: 1.25rem 1.8rem; }
}

/* Wide screens: the column a little wider, and the hero's words start at its right edge. */
@media (min-width: 64em) {
  :root { --block: 48rem; --edge: max(var(--gutter), (100% - var(--block)) / 2); }
}
@media (min-width: 80em) {
  /* The column grows with the screen; 60vw leaves 20vw on each side, so the name's
     20vw right edge sits exactly on the content's right edge. */
  :root { --block: 60vw; --edge: max(var(--gutter), (100% - var(--block)) / 2); }
}

@media (prefers-reduced-motion: reduce) {
  .hero-text, .hero-still, .hero-sky, .email, .go, a.card { transition: none; animation: none; }
}
