/* ============================================================
   Emre Tokerler — Generative Studio
   Bespoke, hand-built. Warm-dark, art-directed.
   ============================================================ */

:root {
  /* ---- dark (default, canonical) ---- */
  --bg: #0c0b0a;          /* warm near-black */
  --bg-2: #131110;
  --surface: #19161300;
  --text: #ece6dc;        /* warm bone */
  --muted: #8c8377;
  --faint: #5b554d;
  --line: #2a2622;
  --accent: #ff5a36;      /* warm coral — the single signal color */
  --accent-deep: #d8431f;

  --scrim: 12, 11, 10;    /* hero gradient + hint pill base (matches --bg) */
  --chrome: linear-gradient(180deg, #1c1916, #151210);   /* shot title-bar */
  --shot-shadow: 0 26px 55px -24px rgba(0,0,0,.85), inset 0 1px 0 rgba(236,230,220,.04);
  --shot-shadow-hover: 0 34px 66px -22px rgba(0,0,0,.9), inset 0 1px 0 rgba(236,230,220,.05);

  --serif: 'Bricolage Grotesque', system-ui, sans-serif;
  --sans: 'Space Grotesk', system-ui, sans-serif;
  --mono: 'Space Mono', ui-monospace, monospace;

  --pad: clamp(20px, 5vw, 80px);
  --maxw: 1320px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---- light (warm paper, not stark white) ---- */
:root[data-theme="light"] {
  --bg: #f3efe6;          /* warm paper */
  --bg-2: #e8e1d3;        /* card / window — a touch deeper */
  --surface: #ffffff00;
  --text: #1b1714;        /* warm ink */
  --muted: #6c6358;       /* warm taupe */
  --faint: #a59b8a;       /* de-emphasis */
  --line: #d9d0c0;        /* hairline on paper */
  --accent: #d8431f;      /* deepened coral — legible on light */
  --accent-deep: #b8381a;

  --scrim: 243, 239, 230;
  --chrome: linear-gradient(180deg, #ece5d8, #e2dac9);
  --shot-shadow: 0 22px 48px -26px rgba(60,44,28,.42), inset 0 1px 0 rgba(255,255,255,.5);
  --shot-shadow-hover: 0 30px 60px -24px rgba(60,44,28,.5), inset 0 1px 0 rgba(255,255,255,.6);
}

/* theme transition — smooth, only the color props, never layout */
body, .nav-mark, .nav-links a, .nav-resume, .shot, .shot-bar, .shot-url,
.hold-hint, .theme-toggle { transition: background-color .5s var(--ease), color .5s var(--ease), border-color .5s var(--ease); }
@media (prefers-reduced-motion: reduce) {
  body, .nav-mark, .nav-links a, .nav-resume, .shot, .shot-bar, .shot-url,
  .hold-hint, .theme-toggle { transition: none; }
  .hold-hint.show, .hh-dot, .hh-dot::after { animation: none; }
}

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

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: clamp(15px, 1.05vw, 17px);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  -webkit-user-select: none; user-select: none;   /* Cmd+A in Safari paints a selection layer that blanks the <canvas> — keep the whole doc unselectable */
}

a { color: inherit; text-decoration: none; }
em { font-style: italic; }
::selection { background: var(--accent); color: var(--bg); }

/* ---------- Nav ---------- */
.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px var(--pad);
  border-bottom: 1px solid transparent;
  transition: background-color .35s var(--ease), border-color .35s var(--ease), backdrop-filter .35s var(--ease);
}
.nav-scrolled {   /* once scrolled off the hero — a backdrop so the bar reads over content */
  background: rgba(var(--scrim), .8);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  border-bottom-color: var(--line);
}
@media (prefers-reduced-motion: reduce) { .nav { transition: none; } }
.nav-mark { font-family: var(--serif); font-size: 1.35rem; font-weight: 500; letter-spacing: .02em; color: var(--text); }
.nav-mark-dot { color: var(--accent); }
.nav-links { display: flex; gap: clamp(18px, 2.5vw, 40px); align-items: center; }
.nav-links a { font-size: .82rem; letter-spacing: .04em; color: var(--text); position: relative; }
.nav-links a::after { content: ""; position: absolute; left: 0; bottom: -4px; width: 0; height: 1px; background: currentColor; transition: width .35s var(--ease); }
.nav-links a:hover::after { width: 100%; }
.nav-resume { padding: 7px 16px; border: 1px solid color-mix(in srgb, var(--text) 38%, transparent); border-radius: 100px; }
.nav-resume::after { display: none; }

/* ---------- Theme toggle ---------- */
.theme-toggle {
  position: relative; width: 38px; height: 38px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0; cursor: pointer; color: var(--text);
  background: transparent; border: 1px solid color-mix(in srgb, var(--text) 22%, transparent);
  border-radius: 50%; -webkit-tap-highlight-color: transparent;
}
.theme-toggle:hover { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 55%, transparent); }
.theme-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.theme-toggle svg { position: absolute; width: 18px; height: 18px; transition: opacity .45s var(--ease), transform .55s var(--ease); }
.theme-toggle .i-sun  { opacity: 1; transform: rotate(0) scale(1); }
.theme-toggle .i-moon { opacity: 0; transform: rotate(-90deg) scale(.5); }
:root[data-theme="light"] .theme-toggle .i-sun  { opacity: 0; transform: rotate(90deg) scale(.5); }
:root[data-theme="light"] .theme-toggle .i-moon { opacity: 1; transform: rotate(0) scale(1); }
@media (prefers-reduced-motion: reduce) { .theme-toggle svg { transition: opacity .2s linear; transform: none !important; } }

/* ---------- Hero ---------- */
.hero { position: relative; min-height: 100svh; display: flex; align-items: center; padding: 0 var(--pad); overflow: hidden; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }   /* no iOS long-press callout while charging */
.hero-canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; -webkit-user-select: none; user-select: none; }
.hero-fx { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 3; pointer-events: none; -webkit-user-select: none; user-select: none; }   /* headline glyph layer — above the darkening overlay, full brightness */
.hold-hint {
  position: fixed; z-index: 90; pointer-events: none; white-space: nowrap;
  display: flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-weight: 700; font-size: .7rem; letter-spacing: .12em; text-transform: uppercase;
  color: var(--bg);                                   /* ink = page bg → flips with theme, always high-contrast on the coral fill */
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));   /* bold filled coral chip (two-tone for depth) instead of a faint scrim pill */
  border: 1px solid color-mix(in srgb, #fff 22%, transparent);              /* faint top sheen → reads as a glossy chip */
  padding: 7px 13px 7px 10px; border-radius: 100px;
  box-shadow: 0 6px 18px -4px color-mix(in srgb, var(--accent) 60%, transparent);   /* coral lift so it floats off the field */
  opacity: 0; transform: translateY(6px) scale(.92);
  transition: opacity .28s var(--ease), transform .28s var(--ease);
}
.hold-hint.show { opacity: 1; transform: none; animation: hh-pulse 1.5s var(--ease) infinite; }
.hold-hint em { font-style: normal; opacity: .72; }   /* "drag to aim" — secondary, same ink at lower opacity so "hold to shatter" leads */

/* the press-dot: a finger tapping down + a ripple radiating out — in the contrasting ink so it pops on the coral fill */
.hh-dot { position: relative; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--bg); animation: hh-press 1.5s var(--ease) infinite; }
.hh-dot::after { content: ''; position: absolute; inset: -1px; border-radius: 50%; border: 1.5px solid var(--bg); animation: hh-ripple 1.5s var(--ease) infinite; }
@keyframes hh-press  { 0%, 62%, 100% { transform: scale(1); } 26% { transform: scale(.5); } }
@keyframes hh-ripple { 0%, 26% { transform: scale(1); opacity: .8; } 70%, 100% { transform: scale(2.8); opacity: 0; } }
@keyframes hh-pulse {                                     /* breathe + glow swell to pull the eye to the cue */
  0%, 100% { transform: scale(1);    box-shadow: 0 6px 18px -4px color-mix(in srgb, var(--accent) 55%, transparent), 0 0 0 0 color-mix(in srgb, var(--accent) 0%, transparent); }
  50%      { transform: scale(1.06); box-shadow: 0 8px 24px -4px color-mix(in srgb, var(--accent) 78%, transparent), 0 0 22px 2px color-mix(in srgb, var(--accent) 48%, transparent); }
}
/* mobile call-to-action — an angled "← tap" sticker tucked into the space right of "experiences." */
.tap-cta {
  position: absolute; z-index: 90; pointer-events: none; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 5px;
  transform-origin: left center;
  font-family: var(--mono); font-weight: 700; font-size: var(--tap-size, 1.2rem); letter-spacing: .12em; text-transform: uppercase;
  color: var(--accent);
  text-shadow: 0 1px 8px rgba(var(--scrim), .92), 0 0 16px rgba(var(--scrim), .55);   /* soft dark halo for legibility over the field — no hard outline */
  opacity: 0; transform: translateY(-50%) rotate(var(--tap-angle, -30deg)) scale(.7);
  transition: opacity .4s var(--ease), transform .4s var(--ease);
}
.tap-cta.show { opacity: 1; transform: translateY(-50%) rotate(var(--tap-angle, -30deg)) scale(1); animation: tap-press 1.5s var(--ease) .5s infinite; }
.tap-cta-arrow { display: inline-block; }
@keyframes tap-press {   /* a quick press-and-spring, so the whole sticker (text + arrow) reads as a repeating tap */
  0%, 58%, 100% { transform: translateY(-50%) rotate(var(--tap-angle, -30deg)) scale(1); }
  12%           { transform: translateY(-50%) rotate(var(--tap-angle, -30deg)) scale(.86); }
  26%           { transform: translateY(-50%) rotate(var(--tap-angle, -30deg)) scale(1.03); }
}
@media (prefers-reduced-motion: reduce) { .tap-cta.show { animation: none; } }
.hero::after {
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background:
    linear-gradient(90deg, rgba(var(--scrim),.74) 0%, rgba(var(--scrim),.34) 46%, rgba(var(--scrim),0) 80%),
    linear-gradient(0deg, rgba(var(--scrim),.55) 0%, transparent 32%);
}
.hero-inner { position: relative; z-index: 2; max-width: var(--maxw); width: 100%; margin: 0 auto; padding-top: 8vh; }

.hero-eyebrow { font-family: var(--mono); font-size: .8rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); display: flex; align-items: center; gap: 10px; margin-bottom: 28px; }

.hero-title { font-family: var(--serif); font-weight: 300; font-size: clamp(1.95rem, 8.5vw, 7.4rem); line-height: 0.98; letter-spacing: -0.015em; }
.hero-title .line { display: block; }   /* no overflow clip — letters can move freely under the field */
.hero-title em { color: var(--accent); font-style: italic; }
.hero-title.hl-canvas .ch { color: transparent; }   /* hand-off: canvas owns the headline pixels, DOM kept for a11y/layout */

.hero-sub { max-width: 46ch; margin-top: 30px; color: var(--muted); font-size: clamp(1rem, 1.3vw, 1.2rem); }

.hero-scroll { display: inline-flex; align-items: center; gap: 14px; margin-top: 54px; font-family: var(--mono); font-size: .78rem; letter-spacing: .1em; text-transform: uppercase; color: var(--text); }
.hero-scroll-line { width: 60px; height: 1px; background: var(--accent); transform-origin: left; transition: width .4s var(--ease); }
.hero-scroll:hover .hero-scroll-line { width: 100px; }

/* ---------- About ---------- */
.about { max-width: var(--maxw); margin: 0 auto; padding: clamp(90px, 16vh, 200px) var(--pad); }
.about-kicker, .section-kicker { font-family: var(--mono); font-size: .78rem; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); margin-bottom: 34px; }
.about-lead { font-family: var(--serif); font-weight: 300; font-size: clamp(1.6rem, 3.6vw, 3rem); line-height: 1.22; letter-spacing: -0.01em; max-width: 20ch + 40ch; }
.about-lead { max-width: 24ch; }
@media (min-width: 720px) { .about-lead { max-width: 60ch; } }
.about-lead .hl { color: var(--accent); }
.about-meta { margin-top: 40px; font-family: var(--mono); font-size: .82rem; letter-spacing: .04em; color: var(--muted); }
.about-meta a { color: var(--text); border-bottom: 1px solid var(--line); padding-bottom: 2px; transition: border-color .3s; }
.about-meta a:hover { border-color: var(--accent); }

/* ---------- Work ---------- */
.work { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--pad) clamp(60px, 10vh, 140px); }
.work-head { margin-bottom: clamp(50px, 9vh, 120px); border-top: 1px solid var(--line); padding-top: 40px; }
.section-title { font-family: var(--serif); font-weight: 300; font-size: clamp(1.9rem, 5vw, 4rem); line-height: 1.02; letter-spacing: -0.015em; max-width: 16ch; }

.project { display: grid; grid-template-columns: 1fr; gap: clamp(28px, 4vw, 60px); padding: clamp(40px, 7vh, 90px) 0; border-top: 1px solid var(--line); }
@media (min-width: 940px) {
  .project { grid-template-columns: 88px 1fr 1.05fr; align-items: start; }
  .project--reverse .project-index { order: 1; }
  .project--reverse .project-media { order: 2; }
  .project--reverse .project-body { order: 3; }
}

.project-index { font-family: var(--mono); font-size: .82rem; color: var(--muted); display: flex; gap: 8px; align-items: baseline; }
.project-count { color: var(--faint); font-size: .7rem; }

.project-meta { display: flex; flex-wrap: wrap; gap: 10px 20px; align-items: center; font-family: var(--mono); font-size: .74rem; letter-spacing: .03em; color: var(--muted); margin-bottom: 22px; }
.project-stack { color: var(--faint); }

.project-title { font-family: var(--serif); font-weight: 400; font-size: clamp(2.4rem, 5.5vw, 4.4rem); line-height: 1; letter-spacing: -0.02em; }
.project-tagline { font-size: clamp(1.05rem, 1.6vw, 1.35rem); margin-top: 14px; color: var(--text); }
.project-desc { margin-top: 20px; color: var(--muted); max-width: 46ch; }

.project-link { display: inline-flex; align-items: center; gap: 12px; margin-top: 30px; font-family: var(--mono); font-size: .82rem; letter-spacing: .04em; color: var(--text); }
.project-link .arrow { transition: transform .35s var(--ease); color: var(--accent); }
.project-link:hover .arrow { transform: translateX(8px); }
.project-link span:first-child { border-bottom: 1px solid var(--line); padding-bottom: 3px; transition: border-color .3s; }
.project-link:hover span:first-child { border-color: var(--accent); }
.project-link--soft { color: var(--faint); }
.project-link--soft::before { content: "— "; }

.project-media { width: 100%; position: relative; }
/* soft scene glow so the shots sit in a scene rather than a flat box */
.project-media::before {
  content: ""; position: absolute; z-index: 0; inset: -12% -8% -16%;
  background: radial-gradient(54% 54% at 72% 16%, rgba(255,90,54,.13), transparent 72%);
  pointer-events: none;
}
.gallery { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 14px; }

/* a screenshot dressed as an app/browser window — one visual language for every shot */
.shot {
  position: relative; border-radius: 11px; overflow: hidden;
  border: 1px solid var(--line); background: var(--bg-2);
  box-shadow: var(--shot-shadow);
  transition: transform .5s var(--ease), box-shadow .5s var(--ease);
}
.shot--main:hover { transform: translateY(-3px); box-shadow: var(--shot-shadow-hover); }
.shot-bar {
  display: flex; align-items: center; gap: 7px; height: 34px; padding: 0 14px;
  background: var(--chrome);
  border-bottom: 1px solid var(--line);
}
.shot-bar i { width: 9px; height: 9px; border-radius: 50%; background: var(--faint); flex: none; }
.shot-bar i:first-child { background: var(--accent); opacity: .85; }
.shot-url {
  margin: 0 auto; font-family: var(--mono); font-size: .66rem; letter-spacing: .03em;
  color: var(--muted); background: var(--bg); border: 1px solid var(--line);
  border-radius: 6px; padding: 4px 16px; max-width: 64%;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.shot--main img { display: block; width: 100%; max-height: 440px; object-fit: cover; object-position: top center; cursor: zoom-in; }
.shot--bare img { display: block; width: 100%; cursor: zoom-in; }

.gallery-thumbs { display: flex; gap: 14px; }
.thumb {
  flex: 1; height: 72px; padding: 0; border-radius: 8px; overflow: hidden;
  border: 1px solid var(--line); background: var(--bg-2); cursor: zoom-in; position: relative;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top center; display: block;
  opacity: .72; transition: opacity .3s var(--ease), transform .5s var(--ease); }
.thumb:hover img { opacity: 1; transform: scale(1.05); }

/* lightbox */
.lightbox {
  position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center;
  background: rgba(8,7,6,.93); backdrop-filter: blur(6px); padding: 4vh 4vw;
}
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 100%; max-height: 92vh; border-radius: 10px; border: 1px solid var(--line); box-shadow: 0 40px 90px -20px rgba(0,0,0,.85); }
.lightbox-close { position: absolute; top: 20px; right: 28px; background: none; border: none; color: var(--text); font-size: 2.1rem; line-height: 1; cursor: pointer; opacity: .7; transition: opacity .3s; }
.lightbox-close:hover { opacity: 1; }

/* ---------- Contact ---------- */
.contact { max-width: var(--maxw); margin: 0 auto; padding: clamp(90px, 18vh, 240px) var(--pad) clamp(70px, 12vh, 150px); border-top: 1px solid var(--line); text-align: center; }
.contact-mail { display: inline-block; font-family: var(--serif); font-weight: 300; font-size: clamp(2rem, 8vw, 6.2rem); line-height: 1; letter-spacing: -0.02em; margin: 18px 0 50px; transition: color .3s; }
.contact-mail:hover { color: var(--accent); }
.contact-row { display: flex; flex-wrap: wrap; gap: 16px 36px; justify-content: center; font-family: var(--mono); font-size: .84rem; letter-spacing: .04em; color: var(--muted); }
.contact-row a { color: var(--text); transition: color .3s; }
.contact-row a:hover { color: var(--accent); }

/* ---------- Footer ---------- */
.footer { display: flex; flex-wrap: wrap; gap: 10px 20px; justify-content: space-between; padding: 30px var(--pad); border-top: 1px solid var(--line); font-family: var(--mono); font-size: .74rem; letter-spacing: .04em; color: var(--faint); }

/* ---------- Reveal states ---------- */
.js .reveal { opacity: 0; transform: translateY(26px); }
.js .hero-title .line em, .js .hero-title .line { will-change: transform; }
@media (prefers-reduced-motion: reduce) {
  .js .reveal { opacity: 1 !important; transform: none !important; }
}

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  .nav-links { gap: 16px; }
  .nav-links a:not(.nav-resume) { display: none; }
  .hero-sub { font-size: 1rem; }
}

/* ---------- Debug fps overlay (only rendered when the page is loaded with ?fps) ---------- */
.fps-meter {
  position: fixed; left: 50%; top: calc(env(safe-area-inset-top, 0px) + 60px); transform: translateX(-50%);
  z-index: 9999; pointer-events: none; white-space: nowrap;
  font-family: var(--mono, monospace); font-size: 12px; letter-spacing: .03em; line-height: 1;
  color: #fff; background: rgba(0, 0, 0, .72); padding: 7px 12px; border-radius: 7px;
  border: 1px solid rgba(255, 255, 255, .28); -webkit-font-smoothing: auto;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .4);
}
