/* =========================================================
   choses.cool — editorial portfolio
   Tokens · Reset · Layout · Components · Motion · Responsive
   ========================================================= */

/* ---------- Tokens ---------- */
:root {
  /* Palette — near-white paper with deep ink and a single forest accent */
  --bg:        #fafaf7;
  --bg-soft:   #f3f3ee;
  --bg-deep:   #ecece5;
  --ink:       #0f1411;
  --ink-2:     #2a302c;
  --muted:     #5e645e;
  --muted-2:   #9a9e98;
  --line:      #e4e4dd;
  --accent:    #2d5f3f;
  --accent-2:  #224a30;

  /* Type */
  --font-display: 'Instrument Serif', 'Times New Roman', serif;
  --font-body:    'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono:    'JetBrains Mono', ui-monospace, monospace;

  /* Fluid scale */
  --step--1: clamp(0.78rem, 0.74rem + 0.18vw, 0.88rem);
  --step-0:  clamp(0.95rem, 0.90rem + 0.25vw, 1.05rem);
  --step-1:  clamp(1.10rem, 1.02rem + 0.40vw, 1.30rem);
  --step-2:  clamp(1.40rem, 1.20rem + 0.90vw, 1.85rem);
  --step-3:  clamp(2.00rem, 1.60rem + 2.00vw, 3.00rem);
  --step-4:  clamp(2.80rem, 2.00rem + 4.00vw, 4.80rem);
  --step-5:  clamp(3.40rem, 2.20rem + 6.40vw, 7.20rem);

  /* Layout */
  --gutter:   clamp(1.25rem, 3vw, 2.5rem);
  --max-w:    1280px;
  --radius:   2px;
  --radius-lg: 14px;

  /* Motion */
  --ease:     cubic-bezier(0.22, 1, 0.36, 1);
  --t-fast:   180ms;
  --t-med:    420ms;
  --t-slow:   720ms;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 6rem;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.55;
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  /* Subtle paper grain */
  background-image:
    radial-gradient(circle at 25% 10%, rgba(45, 95, 63, 0.035), transparent 40%),
    radial-gradient(circle at 80% 80%, rgba(15, 20, 17, 0.025), transparent 50%);
  background-attachment: fixed;
}

/* Faint film grain overlay */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.25;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.06  0 0 0 0 0.08  0 0 0 0 0.07  0 0 0 0.14 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; background: none; border: 0; color: inherit; cursor: pointer; }
ul, ol { list-style: none; }

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

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

.skip-link {
  position: absolute;
  top: -40px; left: 1rem;
  background: var(--ink); color: var(--bg);
  padding: 0.5rem 0.75rem; z-index: 100;
  transition: top var(--t-fast) var(--ease);
}
.skip-link:focus { top: 1rem; }

/* ---------- Header / Nav ---------- */
.site-header {
  position: fixed; top: 0; left: 0; right: 0;
  z-index: 60;
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.25rem var(--gutter);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(12px) saturate(120%);
  -webkit-backdrop-filter: blur(12px) saturate(120%);
  border-bottom: 1px solid transparent;
  transition: border-color var(--t-med) var(--ease), padding var(--t-med) var(--ease);
}
.site-header.is-scrolled {
  border-bottom-color: var(--line);
  padding-block: 0.85rem;
}

.brand {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: var(--step-1);
  letter-spacing: -0.02em;
  font-style: italic;
  display: inline-flex; align-items: baseline;
}
.brand-mark { color: var(--ink); }
.brand-dot  { color: var(--accent); }
.brand-tld  { color: var(--ink-2); }

.site-nav { position: relative; }
.nav-list {
  display: flex; gap: clamp(1rem, 2.5vw, 2rem);
  align-items: center;
  font-size: var(--step--1);
  font-weight: 500;
  letter-spacing: 0.02em;
}
.nav-list a {
  position: relative;
  padding: 0.4rem 0.1rem;
  color: var(--ink-2);
  transition: color var(--t-fast) var(--ease);
}
.nav-list a:not(.nav-cta)::after {
  content: ""; position: absolute; left: 0; right: 100%; bottom: 0.1rem;
  height: 1px; background: var(--ink);
  transition: right var(--t-med) var(--ease);
}
.nav-list a:hover { color: var(--ink); }
.nav-list a:hover::after { right: 0; }

.nav-cta {
  background: var(--ink);
  color: var(--bg) !important;
  padding: 0.55rem 0.95rem !important;
  border-radius: 999px;
  transition: background var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
.nav-cta:hover { background: var(--accent); transform: translateY(-1px); }
.nav-cta span { display: inline-block; transition: transform var(--t-fast) var(--ease); }
.nav-cta:hover span { transform: translateX(2px); }

.nav-toggle {
  display: none;
  width: 40px; height: 40px;
  position: relative;
  z-index: 60;
}
.nav-toggle span {
  position: absolute; left: 8px; right: 8px; height: 1.5px;
  background: var(--ink);
  transition: transform var(--t-med) var(--ease), opacity var(--t-fast);
}
.nav-toggle span:nth-child(1) { top: 16px; }
.nav-toggle span:nth-child(2) { top: 22px; }
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(3px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { transform: translateY(-3px) rotate(-45deg); }

/* ---------- Main shell ---------- */
main { position: relative; z-index: 2; }

.section {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: clamp(5rem, 12vh, 9rem) var(--gutter);
  position: relative;
}

.section + .section { border-top: 1px solid var(--line); }

.section-head { margin-bottom: clamp(2.5rem, 6vw, 4.5rem); }

.section-num {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: var(--step--1);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 1.5rem;
  position: relative;
  padding-left: 1.4rem;
}
.section-num::before {
  content: "";
  position: absolute;
  left: 0; top: 50%;
  width: 1rem; height: 1px;
  background: var(--muted);
}

.section-title {
  font-family: var(--font-display);
  font-size: var(--step-4);
  line-height: 1.02;
  letter-spacing: -0.025em;
  color: var(--ink);
  max-width: 18ch;
}
.section-title em {
  font-style: italic;
}
.section-title .accent {
  font-style: italic;
  color: var(--accent);
}
.section-tag {
  margin-top: 1.25rem;
  font-size: var(--step-1);
  color: var(--muted);
  max-width: 38ch;
  font-weight: 400;
}

/* ---------- Hero ---------- */
.hero {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: clamp(7rem, 18vh, 11rem) var(--gutter) clamp(3rem, 8vh, 5rem);
  min-height: 92vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  position: relative;
}

.hero-title {
  font-family: var(--font-display);
  font-size: var(--step-5);
  line-height: 0.96;
  letter-spacing: -0.035em;
  color: var(--ink);
  margin-bottom: clamp(2rem, 5vw, 3rem);
  text-align: center;
}
.hero-title em {
  font-style: italic;
}
.hero-title .accent {
  color: var(--accent);
}

.hero-title span { display: block; }

.hero-sub {
  font-family: var(--font-display);
  font-style: italic;
  font-size: var(--step-2);
  color: var(--muted);
  max-width: 32ch;
  line-height: 1.3;
  text-align: center;
}

.hero-scroll {
  position: absolute;
  bottom: clamp(2rem, 5vh, 3.5rem);
  left: 0;
  right: 0;
  margin-inline: auto;
  width: fit-content;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-mono);
  font-size: var(--step--1);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}
.hero-scroll svg { animation: nudge 2s ease-in-out infinite; }
@keyframes nudge {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(4px); }
}

/* ---------- Work ---------- */
.work-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.work-card {
  background: var(--bg);
  transition: background var(--t-med) var(--ease);
}
.work-card:hover { background: var(--bg-soft); }

.work-link {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding: clamp(1.75rem, 3.5vw, 2.75rem);
  height: 100%;
  min-height: 280px;
  position: relative;
  transition: transform var(--t-med) var(--ease);
}

.work-card-head {
  display: flex; justify-content: space-between;
  font-family: var(--font-mono);
  font-size: var(--step--1);
  color: var(--muted);
  letter-spacing: 0.06em;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}

.work-name {
  font-family: var(--font-display);
  font-size: var(--step-3);
  letter-spacing: -0.02em;
  color: var(--ink);
  line-height: 1;
  transition: color var(--t-fast) var(--ease);
}
.work-card:hover .work-name { color: var(--accent); }

.work-role {
  color: var(--muted);
  max-width: 38ch;
  font-size: var(--step-0);
  margin-top: -0.4rem;
}

.work-foot {
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding-top: 1.5rem;
  gap: 1rem;
}
.work-tags { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.work-tags span {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  padding: 0.3rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-2);
  background: var(--bg);
}
.work-arrow {
  font-size: 1.6rem;
  color: var(--ink);
  transition: transform var(--t-med) var(--ease), color var(--t-fast) var(--ease);
  display: inline-block;
}
.work-card:hover .work-arrow {
  transform: translate(4px, -4px);
  color: var(--accent);
}

/* ---------- About ---------- */
.about-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: clamp(2rem, 6vw, 5rem);
  align-items: start;
}

.about-prose { font-size: var(--step-1); line-height: 1.55; color: var(--ink-2); }
.about-prose .lede {
  font-size: var(--step-2);
  line-height: 1.4;
  color: var(--ink);
  font-weight: 400;
}
.about-prose p + p { margin-top: 1.5rem; }

.pull-quote {
  font-family: var(--font-display);
  font-style: italic;
  font-size: var(--step-3);
  line-height: 1.15;
  color: var(--accent);
  letter-spacing: -0.02em;
  margin: 2.5rem 0;
  padding-left: 1.25rem;
  border-left: 2px solid var(--accent);
}

.about-side {
  position: sticky;
  top: 6rem;
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

.stats {
  display: grid;
  gap: 0.5rem;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 1.5rem 0;
}
.stat {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: 0.6rem 0;
}
.stat dt {
  font-family: var(--font-mono);
  font-size: var(--step--1);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.stat dd { display: inline-flex; }
.stat-num {
  font-family: var(--font-display);
  font-size: var(--step-3);
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--ink);
}
.stat-plus {
  color: var(--accent);
  font-style: italic;
  margin-left: 0.05em;
}

.stack-title {
  font-family: var(--font-mono);
  font-size: var(--step--1);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 500;
  margin-bottom: 1rem;
}
.stack-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.stack-list li {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
  transition: background var(--t-fast), border-color var(--t-fast);
}
.stack-list li:hover {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}

/* ---------- Writing ---------- */
.post-list {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--line);
}

.post {
  border-bottom: 1px solid var(--line);
  transition: background var(--t-med) var(--ease);
}
.post:hover:not(.post-soon) { background: var(--bg-soft); }

.post-link, .post-soon {
  display: grid;
  grid-template-columns: 8rem 1fr auto auto;
  align-items: center;
  gap: 1.5rem;
  padding: 1.6rem 0.5rem;
  position: relative;
}
.post-soon { color: var(--muted-2); font-style: italic; }

.post-date {
  font-family: var(--font-mono);
  font-size: var(--step--1);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.post-title {
  font-family: var(--font-display);
  font-size: var(--step-2);
  letter-spacing: -0.015em;
  color: var(--ink);
  transition: color var(--t-fast) var(--ease), transform var(--t-med) var(--ease);
  transform-origin: left;
}
.post-soon .post-title { color: var(--muted-2); font-style: italic; }

.post:hover:not(.post-soon) .post-title { color: var(--accent); transform: translateX(4px); }

.post-meta {
  font-family: var(--font-mono);
  font-size: var(--step--1);
  color: var(--muted);
}
.post-arrow {
  font-size: 1.3rem;
  color: var(--ink);
  transition: transform var(--t-med) var(--ease), color var(--t-fast);
}
.post:hover:not(.post-soon) .post-arrow { transform: translate(3px, -3px); color: var(--accent); }

/* ---------- Contact ---------- */
.section-contact {
  text-align: center;
  padding-block: clamp(7rem, 16vh, 11rem);
}

.contact-title {
  font-family: var(--font-display);
  font-size: var(--step-5);
  line-height: 0.98;
  letter-spacing: -0.035em;
  color: var(--ink);
  max-width: 16ch;
  margin: 0 auto;
}
.contact-title em {
  font-style: italic;
  color: var(--accent);
}

.contact-actions {
  margin-top: clamp(2.5rem, 6vw, 4rem);
  display: flex;
  justify-content: center;
}
.contact-cta {
  display: inline-flex;
  align-items: center;
  gap: 1rem;
  padding: 1.1rem 2rem;
  background: var(--ink);
  color: var(--bg);
  border-radius: 999px;
  font-size: var(--step-1);
  font-weight: 500;
  letter-spacing: -0.005em;
  transition: background var(--t-med) var(--ease), transform var(--t-med) var(--ease);
}
.contact-cta:hover {
  background: var(--accent);
  transform: translateY(-2px);
}
.contact-cta svg { transition: transform var(--t-med) var(--ease); }
.contact-cta:hover svg { transform: translateX(4px); }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  background: var(--bg-deep);
  position: relative; z-index: 2;
}
.footer-grid {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: clamp(3rem, 6vw, 4.5rem) var(--gutter) 2rem;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 2.5rem;
  align-items: start;
}
.footer-brand .brand-mark,
.footer-brand .brand-dot,
.footer-brand .brand-tld {
  font-family: var(--font-display);
  font-style: italic;
  font-size: var(--step-1);
}
.footer-line {
  margin-top: 1rem;
  color: var(--muted);
  max-width: 38ch;
  font-size: var(--step--1);
}

.footer-nav ul,
.footer-social {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  font-size: var(--step--1);
}
.footer-nav a, .footer-social a {
  color: var(--ink-2);
  transition: color var(--t-fast);
}
.footer-nav a:hover, .footer-social a:hover { color: var(--accent); }

.footer-base {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 1.25rem var(--gutter);
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.footer-base code {
  background: var(--bg);
  padding: 0.15rem 0.35rem;
  border-radius: 3px;
  border: 1px solid var(--line);
  text-transform: none;
}

/* ---------- Reveals ---------- */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity var(--t-slow) var(--ease) var(--d, 0ms),
              transform var(--t-slow) var(--ease) var(--d, 0ms);
}
.is-loaded .reveal,
.in-view .reveal,
.reveal.is-in {
  opacity: 1;
  transform: translateY(0);
}

.hero-title .reveal { transform: translateY(36px); }
.is-loaded .hero-title .reveal { transform: translateY(0); }

.section-head, .work-card, .about-grid, .post {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity var(--t-slow) var(--ease), transform var(--t-slow) var(--ease);
}
.in-view .section-head,
.in-view .work-card,
.in-view .about-grid,
.in-view .post {
  opacity: 1;
  transform: translateY(0);
}
.in-view .work-card:nth-child(2) { transition-delay: 120ms; }
.in-view .post:nth-child(2)      { transition-delay: 100ms; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .reveal, .section-head, .work-card, .about-grid, .post {
    opacity: 1; transform: none;
  }
  html { scroll-behavior: auto; }
}

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .work-grid { grid-template-columns: 1fr; }
  .about-grid { grid-template-columns: 1fr; gap: 3rem; }
  .about-side { position: static; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-brand { grid-column: 1 / -1; }
  .post-link, .post-soon { grid-template-columns: 6rem 1fr auto; }
  .post-meta { display: none; }

  .nav-toggle { display: block; }
  .nav-list {
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 240px;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    flex-direction: column;
    align-items: stretch;
    padding: 0.5rem;
    margin: 0.75rem var(--gutter) 0 0;
    gap: 0;
    box-shadow: 0 20px 50px rgba(15, 20, 17, 0.08);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity var(--t-fast) var(--ease),
                transform var(--t-fast) var(--ease),
                visibility var(--t-fast);
  }
  .nav-list.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }
  .nav-list li {
    width: 100%;
    border-bottom: 1px solid var(--line);
  }
  .nav-list li:last-child { border-bottom: none; }
  .nav-list a {
    display: block;
    width: 100%;
    padding: 0.85rem 1rem;
    font-family: var(--font-display);
    font-style: italic;
    font-size: 1.35rem;
    color: var(--ink);
    line-height: 1.2;
  }
  .nav-list a::after { display: none; }
  .nav-cta {
    background: transparent !important;
    color: var(--accent) !important;
    padding: 0.85rem 1rem !important;
    border-radius: 0;
  }
}

@media (max-width: 640px) {
  .footer-grid { grid-template-columns: 1fr; gap: 2rem; }
  .footer-base { flex-direction: column; gap: 0.5rem; align-items: flex-start; }
  .post-link, .post-soon { grid-template-columns: 5rem 1fr auto; gap: 1rem; }
  .post-title { font-size: var(--step-1); }
}