/* atakanakin.dev — "sticker sheet on a sunny pond". Static: no JS, no external requests.
   Theme follows prefers-color-scheme: light = warm dotted paper, dark = night pond.
   Rules and rationale: DESIGN.md.

   Fonts (self-hosted WOFF2 subsets, Latin + Latin Extended-A; built by tools/build_assets.py):
   - Grandstander 700 (--font-display): h1, h2, card titles, the wordmark, language
     switch, speech bubble, tags, the email address. Never for running text.
   - Atkinson Hyperlegible Next 400/700 (--font-body): everything else (bio, descriptions,
     link labels and handles, footer).

   Type scale (--fs-*):
   xs   .875rem          footer, tags, language switch
   sm   1rem             handles, status line, small labels
   md   1.0625rem        body
   lg   1.25–1.5rem      bio, 404 text
   xl   1.75–2.25rem     section headings (h2)
   2xl  1.75rem          card titles (h3)
   hero 3.25–6.5rem      the name (h1)
*/

@font-face {
  font-family: "Grandstander";
  font-weight: 700;
  font-style: normal;
  font-display: swap;
  src: url("fonts/grandstander-700.woff2") format("woff2");
}
@font-face {
  font-family: "Atkinson Hyperlegible Next";
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  src: url("fonts/atkinson-next-400.woff2") format("woff2");
}
@font-face {
  font-family: "Atkinson Hyperlegible Next";
  font-weight: 700;
  font-style: normal;
  font-display: swap;
  src: url("fonts/atkinson-next-700.woff2") format("woff2");
}

:root {
  color-scheme: light dark;

  /* Light: sunny pond on warm paper */
  --bg: #fdf3e1;
  --bg-dot: rgb(42 29 20 / 0.09);
  --card: #fffaf0;
  --text: #2a1d14;
  --text-soft: #5f4a3a;
  --line: #2a1d14;          /* sticker outline */
  --shadow: #2a1d14;        /* flat offset shadow */
  --duck: #ffd23f;
  --beak: #ff8c1a;
  --sky: #b9dbff;
  --blush: #ffb3c1;
  --on-color: #2a1d14;      /* text/icons on duck, beak, sky, blush */
  --link: #1a5fb8;
  --focus: #1a5fb8;
  --select: #ffe48a;
  --duck-line: #2a1d14;     /* duck doodle outline */

  --font-display: "Grandstander", "Comic Sans MS", "Chalkboard SE", ui-rounded, system-ui, sans-serif;
  --font-body: "Atkinson Hyperlegible Next", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --fs-xs: 0.875rem;
  --fs-sm: 1rem;
  --fs-md: 1.0625rem;
  --fs-lg: clamp(1.25rem, 1.1rem + 0.7vw, 1.5rem);
  --fs-xl: clamp(1.75rem, 1.4rem + 1.6vw, 2.25rem);
  --fs-2xl: 1.75rem;
  --fs-hero: clamp(3.25rem, 2rem + 7vw, 6.5rem);

  --gutter: 16px;
  --page: 62rem;
  --radius: 22px;
  --border: 2.5px;
  --lift: 5px;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    /* Dark: night pond. Stickers get a cream die-cut edge instead of an ink one. */
    --bg: #121a30;
    --bg-dot: rgb(253 243 225 / 0.07);
    --card: #1d2846;
    --text: #fbf1dd;
    --text-soft: #cbbfa9;
    --line: #fbf1dd;
    --shadow: #05091a;
    --duck: #ffd23f;
    --beak: #ff9d3d;
    --sky: #9fcbff;
    --blush: #ffadbd;
    --on-color: #2a1d14;
    --link: #9ccbff;
    --focus: #ffd23f;
    --select: #3a4f86;
    --duck-line: #fbf1dd;   /* cream die-cut edge at night */
  }
}

/* ---------- Base ---------- */

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scrollbar-color: var(--text-soft) var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow-x: clip;
  background-color: var(--bg);
  background-image: radial-gradient(var(--bg-dot) 1.2px, transparent 1.6px);
  background-size: 22px 22px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--fs-md);
  line-height: 1.6;
  padding:
    env(safe-area-inset-top, 0px)
    env(safe-area-inset-right, 0px)
    env(safe-area-inset-bottom, 0px)
    env(safe-area-inset-left, 0px);
}

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

a {
  color: var(--link);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.2em;
}
a:hover { text-decoration-style: wavy; text-decoration-thickness: 1.5px; }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 4px;
  border-radius: 10px;
}

h1, h2, h3 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.05;
  text-wrap: balance;
}

p { margin: 0; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip {
  position: absolute;
  left: var(--gutter);
  top: -100px;
  z-index: 10;
  padding: 10px 16px;
  background: var(--duck);
  color: var(--on-color);
  font-weight: 700;
  text-decoration: none;
  border: var(--border) solid var(--line);
  border-radius: 12px;
}
.skip:focus { top: calc(env(safe-area-inset-top, 0px) + 12px); }

.wrap {
  width: 100%;
  max-width: calc(var(--page) + 2 * var(--gutter));
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.plain-list { margin: 0; padding: 0; list-style: none; }

/* Shared sticker surface: outline + flat offset shadow + a little tilt. */
.sticker {
  --tilt: 0deg;
  background: var(--card);
  border: var(--border) solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--lift) calc(var(--lift) + 1px) 0 var(--shadow);
  transform: rotate(var(--tilt));
  transition:
    transform 320ms var(--ease-bounce),
    box-shadow 320ms var(--ease-out);
}

/* ---------- Header ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 18px;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  font-family: var(--font-display);
  font-size: 1.125rem;
  color: var(--text);
  text-decoration: none;
}
.wordmark:hover { text-decoration: none; }
.wordmark svg { width: 36px; height: 36px; flex: none; transition: transform 320ms var(--ease-bounce); }
.wordmark:hover svg { transform: rotate(-10deg) scale(1.06); }

.lang {
  display: flex;
  padding: 3px;
  margin: 0;
  list-style: none;
  background: var(--card);
  border: var(--border) solid var(--line);
  border-radius: 999px;
  box-shadow: 3px 3px 0 var(--shadow);
  font-family: var(--font-display);
  font-size: var(--fs-xs);
}
.lang a, .lang span {
  display: block;
  min-width: 44px;
  padding: 8px 10px;
  line-height: 22px;
  text-align: center;
  border-radius: 999px;
}
.lang a { color: var(--text); text-decoration: none; }
.lang a:hover { background: var(--bg); }
.lang span { background: var(--duck); color: var(--on-color); }

/* ---------- Hero ---------- */

main { flex: 1; }

.hero {
  display: grid;
  grid-template-areas: "duck" "text";
  gap: 8px;
  padding: 28px 0 64px;
}
.hero-text { grid-area: text; }

.hero h1 {
  font-size: var(--fs-hero);
  letter-spacing: -0.02em;
  line-height: 0.98;
}
/* Hand-drawn squiggle under the surname. */
.squiggle {
  display: inline-block;
  padding-bottom: 0.14em;
  background: url("img/squiggle.svg") left bottom / 100% 0.22em no-repeat;
}

.bio {
  max-width: 32ch;
  margin-top: 22px;
  font-size: var(--fs-lg);
  line-height: 1.45;
  text-wrap: pretty;
}

.role {
  display: inline-block;
  max-width: 100%;
  margin-top: 26px;
  padding: 8px 16px 9px;
  background: var(--duck);
  color: var(--on-color);
  border: var(--border) solid var(--line);
  border-radius: 14px;
  box-shadow: 3px 4px 0 var(--shadow);
  font-family: var(--font-display);
  font-size: var(--fs-sm);
  line-height: 1.35;
  transform: rotate(-1.5deg);
  transform-origin: left center;
}

.hero-art {
  grid-area: duck;
  position: relative;
  justify-self: end;
  width: clamp(150px, 42vw, 340px);
  margin-right: 4px;
}
.hero-art .duck { display: block; width: 100%; height: auto; }

.bubble {
  position: absolute;
  right: -4%;
  top: -10%;
  padding: 4px 14px 6px;
  background: var(--card);
  color: var(--text);
  border: var(--border) solid var(--line);
  border-radius: 18px 18px 18px 4px;
  z-index: 1;
  box-shadow: 3px 3px 0 var(--shadow);
  font-family: var(--font-display);
  font-size: clamp(1rem, 0.8rem + 1vw, 1.5rem);
  transform: rotate(6deg);
  transform-origin: bottom left;
}

.spark { position: absolute; width: 26px; height: 26px; color: var(--beak); }
.spark--a { left: 18%; top: 4%; }
.spark--b { left: 2%; bottom: 24%; width: 18px; height: 18px; color: var(--link); }

@media (min-width: 48rem) {
  .hero {
    grid-template-areas: "text duck";
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 32px;
    padding: 56px 0 96px;
  }
  .hero-art { margin-right: 12px; }
}

/* Duck doodle colors (shared by the hero and 404 art). */
.duck .ink { fill: none; stroke: var(--duck-line); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
.duck .inner { stroke: #2a1d14; }
.duck .body { fill: var(--duck); }
.duck .beak { fill: var(--beak); }
.duck .eye { fill: #2a1d14; }
.duck .glint { fill: #fff; }
.duck .cheek { fill: var(--blush); }
.duck .water { fill: none; stroke: var(--link); stroke-width: 4; stroke-linecap: round; }

/* ---------- Sections ---------- */

.section { padding: 8px 0 72px; }

.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
  font-size: var(--fs-xl);
}
.section-title svg { width: 30px; height: 30px; flex: none; color: var(--beak); }

/* ---------- Projects ---------- */
/* One <li> per project; the grid grows to 2–3 columns as projects are added. */
.shelf {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 19rem), 1fr));
  align-items: start;
  gap: 32px 28px;
}

.project {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 22px 22px 20px;
}
.shelf > li:nth-child(odd) .project { --tilt: -1.2deg; }
.shelf > li:nth-child(even) .project { --tilt: 1deg; }

.project:hover,
.project:focus-within {
  transform: rotate(0deg) translate(-2px, -4px);
  box-shadow: calc(var(--lift) + 3px) calc(var(--lift) + 5px) 0 var(--shadow);
}
.project:focus-within { outline: 3px solid var(--focus); outline-offset: 5px; }
.project:focus-within a:focus-visible { outline: none; }

.project-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.project-icon {
  display: block;
  width: 88px;
  height: 88px;
  border: var(--border) solid var(--line);
  border-radius: 24px;
}

.tag {
  display: inline-block;
  padding: 4px 12px;
  border: 2px solid var(--line);
  border-radius: 999px;
  font-family: var(--font-display);
  font-size: var(--fs-xs);
  line-height: 1.4;
  color: var(--on-color);
  white-space: nowrap;
  transform: rotate(4deg);
}
.tag--soon { background: var(--beak); }
.tag--live { background: var(--sky); }
.tag--archived { background: var(--card); color: var(--text-soft); border-style: dashed; }

.project-name { margin-top: 18px; font-size: var(--fs-2xl); }
.project-name a { color: var(--text); text-decoration: none; }
/* The whole sticker is the link. */
.project-name a::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }

.project-desc { margin-top: 8px; text-wrap: pretty; }

.project-status {
  margin-top: 14px;
  font-size: var(--fs-sm);
  font-weight: 700;
}

.project-url {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: auto;
  padding-top: 16px;
  color: var(--link);
  font-weight: 700;
  font-size: var(--fs-sm);
}
.project-url span { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 0.2em; }
.project:hover .project-url span { text-decoration-style: wavy; text-decoration-thickness: 1.5px; }
.arrow { width: 18px; height: 18px; flex: none; transition: transform 320ms var(--ease-bounce); }
.project:hover .arrow, .project:focus-within .arrow { transform: translate(3px, -3px); }

/* Empty slot for the next project (not a link, no fake content). */
.project--empty {
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 28px 22px;
  background: transparent;
  border: var(--border) dashed var(--text-soft);
  box-shadow: none;
  color: var(--text-soft);
  text-align: center;
}
.project--empty:hover { transform: rotate(var(--tilt)); box-shadow: none; }
.project--empty svg { width: 72px; height: 72px; }
.project--empty .egg { fill: var(--card); stroke: var(--text-soft); stroke-width: 3; }
.project--empty .crack { fill: none; stroke: var(--text-soft); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Say hi ---------- */

.email {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 22px;
  background: var(--duck);
  color: var(--on-color);
  text-decoration: none;
  --tilt: -1deg;
}
.email:hover { text-decoration: none; }
.email-icon { width: 52px; height: 52px; flex: none; }
@media (max-width: 30rem) {
  .email { gap: 12px; padding: 16px; }
  .email-icon { width: 42px; height: 42px; }
}
.email-icon .env { fill: #fffaf0; stroke: var(--on-color); stroke-width: 2.5; stroke-linejoin: round; }
.email-icon .flap { fill: none; stroke: var(--on-color); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.email-icon .heart { fill: var(--beak); stroke: var(--on-color); stroke-width: 2; stroke-linejoin: round; }
.email-text { display: grid; min-width: 0; }
.email-label { font-size: var(--fs-sm); font-weight: 700; }
.email-address {
  font-family: var(--font-display);
  font-size: clamp(1.0625rem, 0.75rem + 1.6vw, 1.5rem);
  line-height: 1.25;
  overflow-wrap: break-word;
}

.socials {
  display: grid;
  grid-template-columns: 1fr;
  gap: 22px 20px;
  margin-top: 30px;
}
@media (min-width: 30rem) { .socials { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 60rem) { .socials { grid-template-columns: repeat(4, 1fr); } }
.socials > li:nth-child(4n + 1) a { --tilt: 1deg; }
.socials > li:nth-child(4n + 2) a { --tilt: -1.4deg; }
.socials > li:nth-child(4n + 3) a { --tilt: -0.6deg; }
.socials > li:nth-child(4n + 4) a { --tilt: 1.3deg; }

.social {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 76px;
  padding: 12px 16px;
  color: var(--text);
  text-decoration: none;
}
.social:hover { text-decoration: none; }

.email:hover, .email:focus-visible,
.social:hover, .social:focus-visible {
  transform: rotate(0deg) translate(-2px, -4px);
  box-shadow: calc(var(--lift) + 3px) calc(var(--lift) + 5px) 0 var(--shadow);
}

.social-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  flex: none;
  border: var(--border) solid var(--line);
  border-radius: 50%;
  color: var(--on-color);
}
.social-icon svg { width: 22px; height: 22px; fill: currentColor; }
.social--github .social-icon { background: var(--beak); }
.social--linkedin .social-icon { background: var(--sky); }
.social--x .social-icon { background: var(--duck); }
.social--producthunt .social-icon { background: var(--blush); }

.email:hover .email-icon,
.email:focus-visible .email-icon,
.social:hover .social-icon,
.social:focus-visible .social-icon { animation: wiggle 520ms var(--ease-out); }

.social-text { display: grid; min-width: 0; line-height: 1.3; }
.social-name { font-weight: 700; }
.social-handle { color: var(--text-soft); font-size: var(--fs-sm); overflow-wrap: anywhere; }

@keyframes wiggle {
  0% { transform: rotate(0) translateY(0); }
  30% { transform: rotate(-12deg) translateY(-4px); }
  60% { transform: rotate(8deg) translateY(-1px); }
  100% { transform: rotate(0) translateY(0); }
}

/* ---------- Footer ---------- */

.site-footer {
  padding-top: 36px;
  padding-bottom: 32px;
  background: url("img/wave.svg") left top / 48px 12px repeat-x;
  font-size: var(--fs-xs);
  color: var(--text-soft);
}
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 4px 16px; justify-content: space-between; }

/* ---------- 404 ---------- */

.lost {
  display: grid;
  justify-items: start;
  gap: 18px;
  padding: 40px 0 80px;
}
.lost .duck { width: clamp(180px, 50vw, 300px); height: auto; transform-origin: 50% 85%; animation: waddle 2.4s ease-in-out infinite; }
.lost h1 { font-size: clamp(2.5rem, 1.6rem + 5vw, 4.5rem); }
.lost p { max-width: 36ch; font-size: var(--fs-lg); }
.lost .qmark { fill: none; stroke: var(--beak); stroke-width: 5; stroke-linecap: round; }
.lost .qdot { fill: var(--beak); }

@keyframes waddle {
  0%, 100% { transform: rotate(-4deg); }
  50% { transform: rotate(4deg) translateY(-3px); }
}

/* ---------- Motion preferences ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
  .project:hover, .project:focus-within,
  .email:hover, .email:focus-visible,
  .social:hover, .social:focus-visible { transform: rotate(var(--tilt)); }
  .wordmark:hover svg, .project:hover .arrow, .project:focus-within .arrow { transform: none; }
}
