:root {
  --display: "Space Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --redline: #ff5a1f;
  --page: 680px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* Drafting paper by day, blueprint by night */
:root[data-theme="light"] {
  --bg: #f4f1e8;
  --ink: #16181d;
  --muted: rgba(22, 24, 29, 0.68);
  --faint: rgba(22, 24, 29, 0.42);
  --line: rgba(22, 24, 29, 0.14);
  --grid: rgba(40, 70, 120, 0.07);
  --grid-major: rgba(40, 70, 120, 0.12);
  --sheet: rgba(255, 255, 255, 0.55);
  --tile: rgba(255, 255, 255, 0.7);
  --tile-hover: #ffffff;
  --button: #16181d;
  --button-ink: #f4f1e8;
}

:root[data-theme="dark"] {
  --bg: #0e1a2b;
  --ink: #e8eef7;
  --muted: rgba(232, 238, 247, 0.72);
  --faint: rgba(232, 238, 247, 0.45);
  --line: rgba(168, 200, 240, 0.2);
  --grid: rgba(140, 180, 230, 0.07);
  --grid-major: rgba(140, 180, 230, 0.13);
  --sheet: rgba(14, 26, 43, 0.6);
  --tile: rgba(255, 255, 255, 0.04);
  --tile-hover: rgba(255, 255, 255, 0.09);
  --button: #e8eef7;
  --button-ink: #0e1a2b;
}

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

html,
body {
  margin: 0;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    linear-gradient(var(--grid-major) 1px, transparent 1px) 0 0 / 120px 120px,
    linear-gradient(90deg, var(--grid-major) 1px, transparent 1px) 0 0 / 120px 120px,
    linear-gradient(var(--grid) 1px, transparent 1px) 0 0 / 24px 24px,
    linear-gradient(90deg, var(--grid) 1px, transparent 1px) 0 0 / 24px 24px,
    var(--bg);
  color: var(--ink);
  font-family: var(--display);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.5s ease, color 0.5s ease;
}

html[lang="zh-Hant"] body {
  font-family: var(--display), "Microsoft JhengHei", "PingFang TC", "Noto Sans TC", sans-serif;
}

a {
  color: inherit;
}

button,
input {
  font: inherit;
  color: inherit;
}

svg {
  fill: currentColor;
}

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

.skip-link {
  position: absolute;
  left: 12px;
  top: -48px;
  padding: 8px 12px;
  background: var(--button);
  color: var(--button-ink);
  z-index: 10;
}

.skip-link:focus {
  top: 12px;
}

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

/* ---------- Bar ---------- */
.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: calc(var(--page) + 40px);
  margin: 0 auto;
  padding: 16px 20px 0;
}

.mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1.5px solid var(--ink);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
}

.bar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.lang {
  display: flex;
  border: 1px solid var(--line);
}

.lang-btn {
  padding: 5px 9px;
  border: 0;
  background: transparent;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--faint);
  cursor: pointer;
}

.lang-btn[aria-pressed="true"] {
  background: var(--button);
  color: var(--button-ink);
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  background: transparent;
  cursor: pointer;
}

.icon-btn svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}

:root[data-theme="dark"] .icon-sun,
:root[data-theme="light"] .icon-moon {
  display: none;
}

/* ---------- Page ---------- */
.page {
  flex: 1;
  width: 100%;
  max-width: calc(var(--page) + 40px);
  margin: 0 auto;
  padding: 28px 20px 24px;
}

/* ---------- Sheet ---------- */
.sheet {
  position: relative;
  padding: 26px 26px 0;
  border: 1px solid var(--line);
  background: var(--sheet);
  backdrop-filter: blur(2px);
}

.tick {
  position: absolute;
  width: 14px;
  height: 14px;
  border-color: var(--redline);
  border-style: solid;
  border-width: 0;
}

.tl { top: -1px; left: -1px; border-top-width: 2px; border-left-width: 2px; }
.tr { top: -1px; right: -1px; border-top-width: 2px; border-right-width: 2px; }
.bl { bottom: -1px; left: -1px; border-bottom-width: 2px; border-left-width: 2px; }
.br { bottom: -1px; right: -1px; border-bottom-width: 2px; border-right-width: 2px; }

.live {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 0 0 18px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #2fbf71;
  animation: blink 2.4s ease-in-out infinite;
}

.live-dot.is-away {
  background: #e3a008;
}

.live-dot.is-asleep {
  background: #7b8bb0;
  animation: none;
}

@keyframes blink {
  50% { opacity: 0.35; }
}

.live-sep {
  color: var(--faint);
}

.name {
  margin: 0;
  font-size: clamp(44px, 10vw, 68px);
  font-weight: 700;
  line-height: 0.95;
  letter-spacing: -0.035em;
}

.pitch {
  margin: 12px 0 0;
  font-size: clamp(20px, 4.4vw, 26px);
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.cycle {
  position: relative;
  display: inline-block;
  color: var(--redline);
}

.cycle::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0.25em;
  bottom: -2px;
  height: 2px;
  background: currentColor;
  transform-origin: left;
  animation: draw 0.6s var(--ease) both;
}

.cycle.is-swapping {
  animation: swap 0.5s var(--ease);
}

@keyframes swap {
  0% { opacity: 0; transform: translateY(6px); }
  100% { opacity: 1; transform: none; }
}

@keyframes draw {
  from { transform: scaleX(0); }
}

.bio {
  margin: 16px 0 0;
  max-width: 34em;
  font-size: 15.5px;
  color: var(--muted);
}

.bio a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--redline);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
}

.bio a:hover {
  color: var(--redline);
}

/* ---------- Socials ---------- */
.socials {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 22px 0 0;
  padding: 0;
  list-style: none;
}

.social {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 10px;
  border: 1px solid var(--line);
  background: var(--tile);
  text-decoration: none;
  transition: background-color 0.2s, border-color 0.2s, transform 0.2s var(--ease);
}

.social:hover {
  background: var(--tile-hover);
  border-color: var(--ink);
  transform: translateY(-1px);
}

.social-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 20px;
  height: 20px;
}

.social-icon svg {
  width: 20px;
  height: 20px;
}

.social-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.2;
}

.social-name {
  font-size: 14px;
  font-weight: 600;
}

.social-handle {
  overflow: hidden;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--faint);
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* ---------- Title block ---------- */
.titleblock {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin: 24px -26px 0;
  border-top: 1px solid var(--line);
}

.titleblock div {
  padding: 8px 12px 9px;
  border-left: 1px solid var(--line);
}

.titleblock div:first-child {
  border-left: 0;
  padding-left: 26px;
}

.titleblock dt {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
}

.titleblock dd {
  margin: 0;
  font-family: var(--mono);
  font-size: 12.5px;
}

/* ---------- Build log ---------- */
.log {
  margin-top: 18px;
  padding: 22px 26px 20px;
  border: 1px solid var(--ink);
  background: var(--sheet);
}

.log-title {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.log-sub {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 15px;
}

.log-list {
  display: grid;
  gap: 6px;
  margin: 16px 0 18px;
  padding: 0;
  list-style: none;
  counter-reset: item;
}

.log-list li {
  display: grid;
  grid-template-columns: 92px 1fr;
  align-items: baseline;
  gap: 12px;
  font-size: 14.5px;
  counter-increment: item;
}

.log-key {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--redline);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.log-key::before {
  content: counter(item, decimal-leading-zero) " ";
  color: var(--faint);
}

.signup {
  display: flex;
  gap: 8px;
}

.signup input[type="email"] {
  flex: 1;
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  background: var(--bg);
  font-size: 15px;
  border-radius: 0;
}

.signup input[type="email"]::placeholder {
  color: var(--faint);
}

.signup input[aria-invalid="true"] {
  border-color: var(--redline);
}

.signup button {
  flex: none;
  padding: 12px 18px;
  border: 0;
  background: var(--redline);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  transition: filter 0.2s, transform 0.2s var(--ease);
}

.signup button:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.signup button[disabled] {
  opacity: 0.6;
  cursor: progress;
}

.signup-note {
  margin: 10px 0 0;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--faint);
}

.signup-note.is-ok {
  color: #2fbf71;
}

.signup-note.is-error {
  color: var(--redline);
}

.signup-note a {
  color: inherit;
}

.log.is-done .signup {
  display: none;
}

/* ---------- Footer ---------- */
.foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: baseline;
  gap: 6px 16px;
  width: 100%;
  max-width: calc(var(--page) + 40px);
  margin: 0 auto;
  padding: 4px 20px 28px;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--faint);
}

.foot a {
  text-decoration: none;
}

.foot a:hover,
.privacy summary:hover {
  color: var(--ink);
}

.privacy summary {
  cursor: pointer;
  list-style: none;
}

.privacy summary::-webkit-details-marker {
  display: none;
}

.privacy p {
  max-width: 36em;
  margin: 8px auto 0;
  text-align: center;
}

.privacy[open] {
  flex-basis: 100%;
  text-align: center;
}

/* ---------- Entrance ---------- */
.js .sheet,
.js .log {
  animation: rise 0.7s var(--ease) both;
}

.js .log {
  animation-delay: 0.12s;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

/* ---------- Small screens ---------- */
@media (max-width: 560px) {
  .page {
    padding-top: 18px;
  }

  .sheet {
    padding: 22px 18px 0;
  }

  .socials {
    grid-template-columns: repeat(2, 1fr);
  }

  .titleblock {
    margin: 20px -18px 0;
  }

  .titleblock div:first-child {
    padding-left: 18px;
  }

  .titleblock div {
    padding: 7px 8px 8px;
  }

  .log {
    padding: 20px 18px 18px;
  }

  .log-list li {
    grid-template-columns: 80px 1fr;
    gap: 8px;
  }

  .signup {
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}


/* Portrait: a "detail view" pinned to the sheet's top-right corner */
.portrait {
  float: right;
  margin: 2px 0 12px 20px;
  padding: 5px 5px 0;
  border: 1px solid var(--ink);
  background: var(--tile-hover);
}

.portrait[hidden] {
  display: none;
}

.portrait img {
  display: block;
  width: 132px;
  height: 132px;
  object-fit: cover;
}

.portrait figcaption {
  padding: 5px 0 6px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-align: center;
  color: var(--muted);
}

@media (max-width: 520px) {
  .portrait {
    margin-left: 14px;
  }

  .portrait img {
    width: 96px;
    height: 96px;
  }
}

/* Proof line under the bio */
.proof {
  margin: 14px 0 0;
  font-family: var(--mono);
  font-size: 12.5px;
}

.proof a {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 6px;
  color: var(--muted);
  text-decoration: none;
}

.proof-num {
  font-family: var(--display);
  font-size: 18px;
  font-weight: 700;
  color: var(--redline);
}

.proof-sep {
  color: var(--faint);
}

.proof-latest {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--redline);
  text-underline-offset: 3px;
}

.proof-arrow {
  transition: transform 0.2s var(--ease);
}

.proof a:hover .proof-arrow {
  transform: translateX(3px);
}

.proof a:hover .proof-latest {
  color: var(--redline);
}


/* Proof line + jump-to-signup button share one row */
.cta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  margin-top: 14px;
}

.cta-row .proof {
  margin: 0;
}

.jump {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border: 1px solid var(--button);
  background: var(--button);
  color: var(--button-ink);
  font-family: var(--mono);
  font-size: 12.5px;
  letter-spacing: 0.02em;
  text-decoration: none;
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}

.jump:hover,
.jump:focus-visible {
  background: var(--redline);
  border-color: var(--redline);
  color: #fff;
}

.jump-arrow {
  transition: transform 0.2s var(--ease);
}

.jump:hover .jump-arrow {
  transform: translateY(2px);
}


/* Link to the Substack archive under the signup form */
.past-issues {
  margin: 10px 0 0;
  font-family: var(--mono);
  font-size: 12px;
}

.past-issues a {
  color: var(--muted);
  text-decoration: underline;
  text-decoration-color: var(--redline);
  text-underline-offset: 3px;
}

.past-issues a:hover {
  color: var(--redline);
}
