/* ==========================================================
   robertstanic.com — styles
   Dark-first palette, light theme via [data-scheme="light"].
   ========================================================== */

:root {
  /* dark (default) */
  --bg:          #101418;
  --surface:     #171d22;
  --surface-2:   #1e252b;
  --band:        #151b20;
  --border:      #2b343a;
  --border-soft: #232b31;
  --text:        #e9eef1;
  --text-mid:    #b7c3c9;
  --muted:       #8e9ca3;
  --accent:      #ff8a5b;
  --accent-ink:  #1a0f09;
  --accent-soft: rgba(255, 138, 91, 0.13);
  --code-str:    #8fc9d8;
  --code-dim:    #6c7b83;
  --shadow:      0 24px 60px -28px rgba(0, 0, 0, 0.75);
  --grid-dot:    rgba(255, 255, 255, 0.045);

  --font-body: "IBM Plex Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  --wrap: 1140px;
  --pad: clamp(1.25rem, 4vw, 2.5rem);
  --section-y: clamp(4.5rem, 9vw, 7.5rem);
  --r: 10px;
}

:root[data-scheme="light"] {
  --bg:          #f5f7f8;
  --surface:     #ffffff;
  --surface-2:   #eef2f4;
  --band:        #eaeff1;
  --border:      #d7dfe3;
  --border-soft: #e4eaed;
  --text:        #101619;
  --text-mid:    #33424a;
  --muted:       #5b6a72;
  --accent:      #c9512a;
  --accent-ink:  #fff6f1;
  --accent-soft: rgba(201, 81, 42, 0.1);
  --code-str:    #2c6f80;
  --code-dim:    #7b8a91;
  --shadow:      0 20px 50px -30px rgba(16, 22, 25, 0.3);
  --grid-dot:    rgba(16, 22, 25, 0.05);
}

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

html { scroll-behavior: smooth; scroll-padding-top: 84px; }

body {
  margin: 0;
  background-color: var(--bg);
  background-image: radial-gradient(var(--grid-dot) 1px, transparent 1px);
  background-size: 26px 26px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.25s ease, color 0.25s ease;
}

img { max-width: 100%; display: block; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

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

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 0.6rem 1rem;
  z-index: 50;
  font-weight: 600;
}
.skip:focus { left: 0.5rem; top: 0.5rem; }

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--pad);
}

/* ── typography ─────────────────────────────────────────── */

h1, h2, h3 { margin: 0; text-wrap: balance; letter-spacing: -0.02em; line-height: 1.1; }

h1 { font-size: clamp(2.6rem, 7vw, 4.25rem); font-weight: 700; }
h2 { font-size: clamp(1.75rem, 3.4vw, 2.35rem); font-weight: 600; }
h3 { font-size: 1.15rem; font-weight: 600; letter-spacing: -0.01em; }

p { margin: 0; }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: var(--accent);
  margin-bottom: 0.85rem;
}

.section-lede {
  color: var(--muted);
  font-size: 1.0625rem;
  max-width: 60ch;
  margin-top: 0.9rem;
}
.section-lede.center { margin-inline: auto; text-align: center; }

/* ── header ─────────────────────────────────────────────── */

.site-head {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-soft);
}

.head-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  min-height: 68px;
}

.mark {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 1rem;
  color: var(--text);
}
.mark:hover { text-decoration: none; }
.caret { color: var(--accent); animation: blink 1.15s step-end infinite; }

@keyframes blink { 0%, 45% { opacity: 1; } 50%, 100% { opacity: 0; } }

.nav { display: flex; gap: 2rem; }
.nav a {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  transition: color 0.15s ease;
}
.nav a:hover { color: var(--text); text-decoration: none; }

.head-actions { display: flex; align-items: center; gap: 0.5rem; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--text-mid);
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.icon-btn:hover { color: var(--text); border-color: var(--accent); background: var(--accent-soft); }

.icon-btn .i-sun { display: none; }
:root[data-scheme="light"] .icon-btn .i-sun { display: block; }
:root[data-scheme="light"] .icon-btn .i-moon { display: none; }

.menu-btn { display: none; }

/* ── hero ───────────────────────────────────────────────── */

.hero { padding-block: clamp(3.5rem, 8vw, 6.5rem) clamp(3.5rem, 8vw, 6rem); }

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: clamp(2rem, 5vw, 4rem);
  align-items: center;
}

.hero-copy .lede {
  margin-top: 1.15rem;
  font-size: clamp(1.05rem, 1.6vw, 1.1875rem);
  color: var(--text-mid);
  max-width: 44ch;
}

.cta-row { display: flex; flex-wrap: wrap; gap: 0.85rem; margin-top: 2rem; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.85rem 1.5rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9375rem;
  border: 1px solid transparent;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }

.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 88%, var(--text)); }

.btn-ghost { border-color: var(--border); color: var(--text); }
.btn-ghost:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }

.btn-lg { padding: 1rem 1.9rem; font-size: 1rem; font-family: var(--font-mono); font-weight: 500; }

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-top: 2.25rem;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--muted);
}
.dot { width: 4px; height: 4px; border-radius: 50%; background: var(--border); }

/* code window */

.editor {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.editor-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.tl { width: 10px; height: 10px; border-radius: 50%; display: block; }
.tl-1 { background: #e0705c; }
.tl-2 { background: #e0b45c; }
.tl-3 { background: #6fb98f; }
.editor-file {
  margin-left: 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted);
}

.editor-body {
  margin: 0;
  padding: 1.4rem 1.35rem 1.6rem;
  font-family: var(--font-mono);
  font-size: clamp(0.75rem, 1.05vw, 0.84rem);
  line-height: 1.85;
  color: var(--text-mid);
  overflow-x: auto;
  min-height: 21em;
  white-space: pre;
  tab-size: 4;
}
.editor-body .k { color: var(--accent); }
.editor-body .s { color: var(--code-str); }
.editor-body .c { color: var(--code-dim); font-style: italic; }

.type-caret {
  display: inline-block;
  width: 7px;
  height: 1.05em;
  translate: 0 0.18em;
  background: var(--accent);
  animation: blink 1.15s step-end infinite;
}

/* ── sections ───────────────────────────────────────────── */

.section { padding-block: var(--section-y); }

.band {
  padding-block: var(--section-y);
  background: var(--band);
  border-block: 1px solid var(--border-soft);
}

/* work cards */

.cards {
  list-style: none;
  margin: clamp(2.25rem, 4vw, 3.25rem) 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.5rem;
}

.card {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.6rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  transition: border-color 0.18s ease, transform 0.18s ease;
}
.card:hover { border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); transform: translateY(-3px); }

.card-top { display: flex; align-items: center; justify-content: space-between; }

.app-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 11px;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.9375rem;
  font-weight: 500;
}

.app-icon-img {
  width: 44px;
  height: 44px;
  border-radius: 11px;
  border: 1px solid var(--border-soft);
  object-fit: cover;
}

.tag {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0.25rem 0.5rem;
}

.card p { color: var(--muted); font-size: 0.9375rem; }

.chips { list-style: none; display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0; padding: 0; }
.chips li {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-mid);
  border: 1px solid var(--border-soft);
  background: var(--surface-2);
  border-radius: 5px;
  padding: 0.25rem 0.55rem;
}

.card-note {
  margin-top: auto;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted);
}

.card-link {
  margin-top: auto;
  font-weight: 600;
  font-size: 0.9375rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

/* stack */

.stack-grid {
  margin-top: clamp(2.25rem, 4vw, 3.25rem);
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 2rem;
}
.col-title {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--muted);
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-soft);
}
.stack-col ul { list-style: none; margin: 0.9rem 0 0; padding: 0; display: flex; flex-direction: column; gap: 0.55rem; }
.stack-col li { font-size: 0.9375rem; color: var(--text-mid); }

/* about */

.about-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.75fr) minmax(0, 1.25fr);
  gap: clamp(2rem, 5vw, 4.5rem);
}
.about-body { display: flex; flex-direction: column; gap: 1.1rem; }
.about-body p { color: var(--text-mid); font-size: 1.0625rem; max-width: 62ch; }

/* contact */

.contact .wrap { text-align: center; }
.contact .eyebrow { text-align: center; }
.contact .btn-primary { margin-top: 2.25rem; }

.socials {
  list-style: none;
  display: flex;
  justify-content: center;
  gap: 1.75rem;
  margin: 2rem 0 0;
  padding: 0;
  font-family: var(--font-mono);
  font-size: 0.875rem;
}
.socials a { display: inline-flex; gap: 0.35rem; }

/* footer */

.site-foot { border-top: 1px solid var(--border-soft); padding-block: 1.75rem; }
.foot-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted);
}
.foot-inner a { color: var(--muted); }
.foot-inner a:hover { color: var(--accent); }

/* ── reveal on scroll ───────────────────────────────────── */

/* hidden only when JS is running, so no-JS visitors still see everything */
.js .reveal { opacity: 0; transform: translateY(14px); transition: opacity 0.6s ease, transform 0.6s ease; }
.js .reveal.in { opacity: 1; transform: none; }

/* ── responsive ─────────────────────────────────────────── */

@media (max-width: 1000px) {
  .hero-grid { grid-template-columns: 1fr; }
  .editor { order: 2; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* three cards in two columns leaves a half-width orphan; let the last one span */
  .cards > li:last-child { grid-column: 1 / -1; }
  .stack-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .about-grid { grid-template-columns: 1fr; gap: 1.5rem; }
}

@media (max-width: 720px) {
  .menu-btn { display: inline-grid; }

  .nav {
    position: absolute;
    inset: 68px 0 auto;
    flex-direction: column;
    gap: 0;
    padding: 0.5rem var(--pad) 1rem;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    display: none;
  }
  .nav.open { display: flex; }
  .nav a { padding: 0.85rem 0; border-bottom: 1px solid var(--border-soft); font-size: 0.875rem; }

  .cards { grid-template-columns: 1fr; }
  .stack-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.75rem; }
  /* wrapping left a dangling separator mid-line; stack instead */
  .hero-meta { flex-direction: column; align-items: flex-start; gap: 0.4rem; }
  .hero-meta .dot { display: none; }
  .btn { padding: 0.9rem 1.35rem; }
  .btn-lg { font-size: 0.875rem; padding: 0.95rem 1.25rem; }
  .socials { gap: 1.25rem; }
}

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