/* Shared text-first stylesheet.
   Design engineering experiments: raw material for the real portfolio.
   - Main app: pure stark white and black.
   - Etter stage: faithful Etter canvas backgrounds (#F6F3F1 light / #0e0e11 dark).
*/

:root {
  /* Main app palette: pure stark light */
  --bg: #ffffff;
  --fg: #000000;
  --fg-secondary: #333333;
  --muted: #666666;
  --rule: #e5e5e5;
  --code-bg: #f4f4f5;
  --nav-btn-border: #dcdcdc;
  --nav-btn-hover: #000000;

  /* Etter stage canvas: exact Etter surface tokens */
  --etter-stage-bg: #F6F3F1;
  --etter-stage-border: rgba(0, 0, 0, 0.07);
  --etter-stage-shadow: 0 4px 28px rgba(0, 0, 0, 0.04);
}

:root[data-theme="dark"] {
  /* Main app palette: pure stark dark */
  --bg: #000000;
  --fg: #ffffff;
  --fg-secondary: #cccccc;
  --muted: #888888;
  --rule: #222222;
  --code-bg: #141416;
  --nav-btn-border: #333333;
  --nav-btn-hover: #ffffff;

  /* Etter stage canvas: exact Etter dark surface-elevated / canvas */
  --etter-stage-bg: #0e0e11;
  --etter-stage-border: rgba(255, 255, 255, 0.08);
  --etter-stage-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

* {
  box-sizing: border-box;
}

body {
  font-family: "Google Sans Flex", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.65;
  color: var(--fg);
  background: var(--bg);
  margin: 0;
  padding: 3rem 1.5rem 5rem;
  transition: background-color 0.2s ease, color 0.2s ease;
}

main {
  max-width: 44rem;
  margin: 0 auto;
}

/* Page navigation bar */
.page-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 3rem;
  font-family: inherit;
  font-size: 0.9rem;
}

.nav-link {
  color: var(--muted);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: color 0.15s ease;
}

.nav-link:hover {
  color: var(--fg);
}

.nav-title {
  color: var(--muted);
  font-size: 0.9rem;
}

#theme-toggle {
  font: inherit;
  font-size: 0.95rem;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--nav-btn-border);
  border-radius: 9999px;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: all 0.15s ease;
}

#theme-toggle:hover {
  color: var(--fg);
  border-color: var(--nav-btn-hover);
}

/* Typography & Content Spacing */
h1, h2, h3 {
  font-family: inherit;
  line-height: 1.25;
  color: var(--fg);
}

h1 {
  font-size: 2.2rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  margin: 0 0 0.5rem;
}

.lead {
  font-size: 1.05rem;
  color: var(--fg-secondary);
  line-height: 1.6;
  margin: 0 0 2rem;
}

h2 {
  font-size: 1.3rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  margin: 0 0 0.4rem;
}

h3 {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 1.85rem 0 0.5rem;
}

ul:not(.index-links) {
  margin: 0.5rem 0 1.5rem;
  padding-left: 1.25rem;
}

ul:not(.index-links) li {
  margin-bottom: 0.65rem;
  color: var(--fg-secondary);
  line-height: 1.6;
}

ul:not(.index-links) li strong {
  color: var(--fg);
}

.meta {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.55;
  margin: 0 0 1.25rem;
}

hr {
  border: none;
  border-top: 1px solid var(--rule);
  margin: 3.5rem 0 3rem;
}

a {
  color: inherit;
}

a:hover {
  color: var(--muted);
}

code {
  background: var(--code-bg);
  padding: 0.15em 0.4em;
  font-size: 0.88em;
  border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.placeholder {
  border: 1px dashed var(--rule);
  border-radius: 16px;
  padding: 2.5rem 1.5rem;
  margin: 1.75rem 0;
  color: var(--muted);
  text-align: center;
}

/* Index links list */
.index-links {
  margin: 1.5rem 0 0;
  padding: 0;
  list-style: none;
}

.index-links li {
  margin-bottom: 0.75rem;
}

.index-links a {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: inherit;
  font-size: 1.05rem;
  text-decoration: none;
  transition: color 0.15s ease;
}

.index-links a:hover {
  color: var(--muted);
}

/* Etter stage: clearly differentiated canvas surface.
   Uses Etter's exact canvas backgrounds so the vendored components feel
   docked in their native environment, framed distinctly from our portfolio prose.
   Kept completely unadulterated — no internal chrome or toolbars.
*/
.etter-stage {
  width: 1280px;
  max-width: calc(100vw - 3rem);
  margin: 2.25rem 0 3.5rem 50%;
  transform: translateX(-50%);
  background: var(--etter-stage-bg);
  border: 1px solid var(--etter-stage-border);
  border-radius: 28px;
  box-shadow: var(--etter-stage-shadow);
  padding: 2.5rem 2rem;
  display: block;
  transition: background-color 0.25s ease, border-color 0.25s ease;
}

.etter-stage > div[id^="etter-"] {
  width: 100%;
  min-width: 0;
  display: block;
}

.home-cards-page main,
.prism-cards-page main {
  max-width: 1000px;
}

.home-cards-page .card-collection {
  margin: 0 0 4rem;
}

.home-cards-page .etter-stage--home-cards,
.prism-cards-page .etter-stage--prism-cards {
  width: 1280px;
  max-width: calc(100vw - 3rem);
  margin: 1.25rem 0 3.5rem 50%;
  padding: 2.5rem 2rem;
  transform: translateX(-50%);
  background: var(--etter-stage-bg);
  border: 1px solid var(--etter-stage-border);
  border-radius: 28px;
  box-shadow: var(--etter-stage-shadow);
}

/* Draup Prism tiles have no dark tokens yet — keep the product's slate-10 canvas. */
.prism-cards-page .etter-stage--prism-cards {
  background: #F5F6F7;
}

.home-cards-page #etter-robot-empty-state {
  max-width: 628px;
  margin: 0 auto;
}

#etter-sim {
  min-height: 480px;
}

#etter-pursuit {
  height: 520px;
}

#etter-prism-spectrum {
  min-height: 380px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#etter-prism-cover {
  width: 100%;
}

/* Stage controls outside the view container */
.stage-actions {
  display: flex;
  justify-content: flex-start;
  margin: -1.75rem 0 3.5rem;
}

.stage-actions button {
  font: inherit;
  font-family: inherit;
  font-size: 0.825rem;
  font-weight: 500;
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--nav-btn-border);
  border-radius: 9999px;
  padding: 0.35rem 0.85rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.15s ease;
}

.stage-actions button:hover {
  border-color: var(--nav-btn-hover);
  transform: translateY(-1px);
}

/* Icon adjustments */
i.ph {
  font-size: 1.15em;
  vertical-align: -0.15em;
}

@media (max-width: 768px) {
  body {
    padding: 1.75rem 1rem 4rem;
  }

  .page-nav {
    margin-bottom: 2rem;
  }

  .etter-stage {
    max-width: calc(100vw - 1.5rem);
    padding: 1.5rem 1rem;
    border-radius: 20px;
    margin: 1.5rem 0 2.5rem 50%;
  }

  .home-cards-page .etter-stage--home-cards,
  .prism-cards-page .etter-stage--prism-cards {
    margin: 1rem 0 2.5rem 50%;
  }

  .stage-actions {
    margin: -1.25rem 0 2.5rem;
  }
}

/* Landing: centered, a name, a still, a short letter. */
body.landing {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 1.25rem 1.75rem 1.5rem;
}

body.landing .page-nav {
  margin-bottom: 0;
}

body.landing .mark {
  font-family: "Special Elite", "Courier New", monospace;
  font-size: 1.125rem;
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1;
}

body.landing #theme-toggle {
  width: auto;
  height: auto;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-size: 1rem;
}

body.landing #theme-toggle:hover,
body.landing #copy-email:hover {
  color: var(--fg);
}

body.landing .mail-line a:hover {
  color: var(--fg);
}

body.landing .mail-line a[href^="mailto"] {
  color: var(--muted);
}

body.landing .mail-line a[href^="mailto"] .who {
  color: var(--fg);
}

body.landing main {
  width: min(100%, 44rem);
  margin: 0 auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: safe center;
  padding-bottom: 1.5rem;
}

.identity {
  margin-top: 0;
  text-align: center;
}

body.landing .identity h1 {
  font-family: "Special Elite", "Courier New", monospace;
  font-size: 1.875rem;
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1.1;
  margin: 0;
}

.typed {
  display: inline-block;
  text-align: left;
}

.typed-text.typing {
  border-right: 1.5px solid currentColor;
  padding-right: 0.08em;
  animation: caret 1s steps(1) infinite;
}

@keyframes caret {
  50% { border-right-color: transparent; }
}

body.landing .role {
  margin: 0.7rem 0 0;
  font-size: 1.125rem;
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1.4;
  color: var(--fg);
}

.still {
  width: min(100%, 40rem);
  height: 9.5rem;
  margin: 2.75rem auto 0;
  overflow: hidden;
}

.still video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  pointer-events: none;
}

:root[data-theme="dark"] .still video {
  filter: invert(1);
}

.letter {
  width: min(100%, 36rem);
  margin: 2.75rem auto 0;
  font-size: 1.0625rem;
  line-height: 1.5;
}

.letter p {
  margin: 0;
}

.letter p + p {
  margin-top: 1.15rem;
}

.letter .mail-line {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-top: 1.5rem;
  font-size: 0.9375rem;
  line-height: 1.4;
}

.mail-line a {
  color: var(--fg);
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

#copy-email {
  font: inherit;
  color: var(--fg);
  background: transparent;
  border: 0;
  padding: 0;
  width: 1.4rem;
  height: 1.4rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

#copy-email i {
  font-size: 0.95rem;
}

.landing-foot {
  margin-top: auto;
  padding-top: 3.5rem;
  text-align: center;
  font-size: 0.75rem;
  letter-spacing: 0.01em;
  line-height: 1.4;
  color: var(--muted);
}

body.landing .landing-tabs {
  display: flex;
  justify-content: center;
  align-items: baseline;
  gap: 0.45rem;
  margin: 0 0 1.6rem;
  font-size: 0.9375rem;
  font-weight: 440;
  font-variation-settings: "opsz" 14, "GRAD" 0;
  letter-spacing: -0.011em;
  line-height: 1.4;
  color: var(--muted);
}

body.landing .landing-tabs button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

body.landing .landing-tabs button[aria-selected="true"],
body.landing .landing-tabs button:hover {
  color: var(--fg);
}

body.landing .project-list {
  width: min(100%, 36rem);
  margin: 0.4rem auto 0;
  padding: 0;
  list-style: none;
  text-align: left;
}

body.landing .project-list li {
  margin: 0;
  color: var(--fg);
  font-size: 1.0625rem;
  line-height: 1.4;
}

body.landing .project-list li + li {
  margin-top: 0.7rem;
}

body.landing .project-list a {
  color: inherit;
  text-decoration: none;
}

body.landing .project-list a:hover {
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

@media (prefers-reduced-motion: no-preference) {
  @keyframes settle {
    from {
      opacity: 0;
      transform: translateY(6px);
    }
    to {
      opacity: 1;
      transform: none;
    }
  }

  @keyframes stream {
    from { background-position: 66% 0; }
    to { background-position: 0% 0; }
  }

  body.landing .page-nav,
  body.landing .still {
    animation: settle 1.1s cubic-bezier(0.22, 1, 0.36, 1) both;
  }

  body.landing .still {
    animation-delay: 0.15s;
  }

  .typed-text:not(.typing):not(.typed-done) {
    color: transparent;
  }

  body.landing #copy-email {
    opacity: 0;
  }

  body.landing.is-streaming #copy-email {
    animation: settle 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.3s both;
  }

  body.landing .stream {
    --ink: var(--fg);
    -webkit-text-fill-color: transparent;
    color: transparent;
  }

  body.landing.is-streaming .stream {
    background-image: linear-gradient(
      90deg,
      var(--ink) 0%,
      var(--ink) 33.4%,
      #5c1e28 35%,
      #8c3038 38%,
      #c45652 41.5%,
      transparent 43.8%,
      transparent 100%
    );
    background-size: 300% 100%;
    background-repeat: no-repeat;
    background-position: 100% 0;
    -webkit-background-clip: text;
    background-clip: text;
    animation: stream 1.15s cubic-bezier(0.33, 0, 0.2, 1) both;
  }

  body.landing.is-streaming .role.stream { animation-delay: 0s; }
  body.landing.is-streaming .letter > p.stream:nth-child(1) { animation-delay: 0.1s; }
  body.landing.is-streaming .letter > p.stream:nth-child(2) { animation-delay: 0.2s; }
  body.landing.is-streaming .mail-line .stream { animation-delay: 0.3s; }
  body.landing .mail-line a[href^="mailto"] {
    animation: settle 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.3s both;
  }
  body.landing.is-streaming .landing-foot.stream {
    --ink: var(--muted);
    animation-delay: 0.4s;
  }

  body.landing .stream.stream-done {
    background-image: none;
    -webkit-text-fill-color: currentColor;
    color: var(--fg);
    animation: none;
  }

  body.landing .landing-foot.stream.stream-done {
    color: var(--muted);
  }
}

body.plain {
  min-height: 100dvh;
  padding: 1.5rem;
  display: grid;
  place-items: center;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.plain.inner {
  display: block;
  padding: 22vh 1.5rem 12vh;
}

.sheet {
  margin-bottom: 8vh;
  color: #000;
}

body.plain.inner .sheet {
  width: min(100%, 18rem);
  margin: 0 auto;
}

.sheet h1,
.sheet p,
.sheet ul { margin: 0; }

.tabs {
  display: flex;
  align-items: baseline;
  gap: 0.35rem 0.5rem;
  margin-bottom: 1.75rem;
  font-size: 0.9375rem;
  font-weight: 440;
  font-variation-settings: "opsz" 14, "GRAD" 0;
  letter-spacing: -0.011em;
  line-height: 1.4;
  color: #767676;
}

.tabs a {
  color: inherit;
  text-decoration: none;
  transition: color 0.18s ease;
}

.tabs a:hover,
.tabs a[aria-current="page"] { color: #161616; }

.sheet h1 {
  color: inherit;
  font-family: "Special Elite", "Courier New", monospace;
  font-size: 1.875rem;
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1.15;
}

.sheet .stop { color: #8c3038; }

.sheet .role {
  margin-top: 0.45rem;
  font-size: 1rem;
  font-weight: 440;
  font-variation-settings: "opsz" 16, "GRAD" 0;
  letter-spacing: -0.014em;
  line-height: 1.4;
  color: #5c5c5c;
}

.sheet .links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
  margin-top: 1.65rem;
  font-size: 0.9375rem;
  font-weight: 440;
  font-variation-settings: "opsz" 14, "GRAD" 0;
  letter-spacing: -0.011em;
  line-height: 1.4;
  color: #767676;
}

.sheet .links a,
.sheet .projects a {
  color: inherit;
  text-decoration: none;
  transition: color 0.18s ease;
}

.sheet .links a:hover,
.sheet .projects a:hover { color: #161616; }

.sheet .dot { color: #d4d4d4; }

.sheet .mail {
  display: inline-flex;
  align-items: center;
  gap: 0.32rem;
}

.sheet .copy {
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  width: 1.05em;
  height: 1.05em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  line-height: 0;
  transition: color 0.18s ease;
}

.sheet .copy i { font-size: 1em; }

.sheet .copy:hover { color: #161616; }

.sheet .mail a .who {
  color: #000;
  font-family: "Special Elite", "Courier New", monospace;
  font-weight: 400;
  font-size: 1.12em;
  letter-spacing: 0;
  line-height: 1;
}

.sheet .links a:hover .who { color: #000; }

.sheet .projects {
  list-style: none;
  padding: 0;
}

.sheet .projects li {
  margin: 0;
  color: #767676;
  font-size: 1rem;
  font-weight: 440;
  font-variation-settings: "opsz" 16, "GRAD" 0;
  letter-spacing: -0.014em;
  line-height: 1.4;
}

.sheet .projects li + li { margin-top: 0.7rem; }

.sheet a:focus-visible,
.sheet .copy:focus-visible,
.tabs a:focus-visible {
  outline: 1px solid #c8c8c8;
  outline-offset: 4px;
  border-radius: 2px;
}

body.plain ::selection { background: #ececec; color: #000; }

:root[data-theme="dark"] .sheet { color: #fff; }
:root[data-theme="dark"] .sheet .stop { color: #c45652; }
:root[data-theme="dark"] .sheet .role { color: #a3a3a3; }
:root[data-theme="dark"] .tabs,
:root[data-theme="dark"] .sheet .links,
:root[data-theme="dark"] .sheet .projects li { color: #8a8a8a; }
:root[data-theme="dark"] .tabs a:hover,
:root[data-theme="dark"] .tabs a[aria-current="page"],
:root[data-theme="dark"] .sheet .links a:hover,
:root[data-theme="dark"] .sheet .copy:hover,
:root[data-theme="dark"] .sheet .projects a:hover { color: #f2f2f2; }
:root[data-theme="dark"] .sheet .mail a .who,
:root[data-theme="dark"] .sheet .links a:hover .who { color: #fff; }
:root[data-theme="dark"] .sheet .dot { color: #3a3a3a; }
:root[data-theme="dark"] .sheet a:focus-visible,
:root[data-theme="dark"] .sheet .copy:focus-visible,
:root[data-theme="dark"] .tabs a:focus-visible { outline-color: #3a3a3a; }
:root[data-theme="dark"] body.plain ::selection { background: #2a2a2a; color: #fff; }
