/* ==========================================================================
   Henry Chen's Blog — static refresh
   Brand tokens are extracted verbatim from the source export (see
   SOURCE-AUDIT.md). Layout is a free redesign; palette + fonts are preserved.
   ========================================================================== */

/* ---------- Brand tokens (from source) ---------- */
:root {
  --bg: #000000;            /* page background (source: rgb(0,0,0)) */
  --surface: #111111;       /* panels / footer strip (source: rgb(17,17,17)) */
  --ink: #f1f1f1;           /* h1 / display text (source: rgb(241,241,241)) */
  --white: #ffffff;         /* nav links (source: rgb(255,255,255)) */
  --logo: #e2e2e2;          /* logo text + logo box border (source: rgb(226,226,226)) */
  --body: #919191;          /* body copy (source: rgb(145,145,145)) */
  --footer: #969696;        /* footer copyright (source: rgb(150,150,150)) */
  --line: rgba(255, 255, 255, 0.14);  /* hairline dividers */

  --font-display: "Playfair Display", Georgia, serif;
  --font-body: "Open Sans", Arial, sans-serif;

  --container: 1140px;
  --gutter: clamp(20px, 5vw, 48px);
  --radius: 10px;
}

/* ---------- Fonts (localized; same families/weights as source) ---------- */
@font-face {
  font-family: "Playfair Display";
  src: url("../fonts/playfair-display.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Playfair Display";
  src: url("../fonts/playfair-display.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Playfair Display";
  src: url("../fonts/playfair-display.woff2") format("woff2");
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Open Sans";
  src: url("../fonts/open-sans.woff2") format("woff2");
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Open Sans";
  src: url("../fonts/open-sans.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Open Sans";
  src: url("../fonts/open-sans.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Open Sans";
  src: url("../fonts/open-sans.woff2") format("woff2");
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--body);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

a {
  color: var(--white);
  text-decoration: none;
  transition: color 0.18s ease;
}

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

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

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--white);
  color: var(--bg);
  padding: 8px 16px;
  z-index: 100;
}
.skip-link:focus {
  left: 0;
}

/* ---------- Header ---------- */
.site-header {
  position: relative;
  z-index: 50;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding-block: 20px;
}

.site-logo {
  display: inline-block;
  border: 1px solid var(--logo);
  padding: 8px 16px;
  color: var(--logo);
  font-family: var(--font-display);
  font-size: 22px;
  line-height: 1.3;
  font-weight: 400;
  white-space: nowrap;
}
.site-logo:hover {
  color: var(--white);
  border-color: var(--white);
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.main-nav a {
  color: var(--white);
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 8px 14px;
  position: relative;
}
.main-nav a::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 2px;
  height: 1px;
  background: var(--white);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.22s ease;
}
.main-nav a:hover::after,
.main-nav a[aria-current="page"]::after {
  transform: scaleX(1);
}
.main-nav a[aria-current="page"] {
  text-decoration: underline;
  text-underline-offset: 8px;
}

/* Hamburger (mobile) */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
}
.nav-toggle span {
  display: block;
  height: 2px;
  background: var(--white);
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.nav-toggle[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.nav-toggle[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}
.nav-toggle[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.mobile-nav {
  display: none;
  flex-direction: column;
  border-top: 1px solid var(--line);
  background: var(--bg);
  padding: 12px 0 20px;
}
.mobile-nav a {
  color: var(--white);
  font-size: 15px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 14px var(--gutter);
  border-bottom: 1px solid var(--line);
}
.mobile-nav a[aria-current="page"] {
  color: var(--logo);
}

/* ---------- Hero (index) ---------- */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: clamp(24px, 4vw, 64px);
  align-items: center;
  padding-block: clamp(48px, 8vw, 104px);
}

.hero-media {
  position: relative;
}
.hero-media img {
  width: 100%;
  aspect-ratio: 5 / 8;
  object-fit: cover;
  border-radius: var(--radius);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
}

.hero-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(28px, 5vw, 56px);
}

.hero h1 {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(30px, 4.4vw, 48px);
  line-height: 1.22;
  letter-spacing: 0.01em;
}

/* ---------- Generic sections ---------- */
.section {
  padding-block: clamp(48px, 7vw, 88px);
}
.section + .section {
  border-top: 1px solid var(--line);
}

.page-title {
  margin: 0 0 8px;
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(28px, 4vw, 36px);
  line-height: 1.25;
  text-align: center;
}

.page-lead {
  margin: 0 auto clamp(32px, 5vw, 56px);
  max-width: 680px;
  text-align: center;
  color: var(--body);
}

/* Index bio */
.bio {
  max-width: 780px;
  margin-inline: auto;
  text-align: center;
  font-size: 16px;
  color: var(--body);
}
.bio p {
  margin: 0 0 1.4em;
}
.bio p:last-child {
  margin-bottom: 0;
}

/* ---------- About page ---------- */
.about-grid {
  display: grid;
  grid-template-columns: minmax(0, 380px) minmax(0, 1fr);
  gap: clamp(32px, 5vw, 72px);
  align-items: start;
}
.about-media img {
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border-radius: var(--radius);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
}
.about-copy h1 {
  margin: 0 0 24px;
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(26px, 3.4vw, 38px);
  line-height: 1.25;
}
.about-copy p {
  margin: 0 0 1.5em;
}
.about-copy p:last-child {
  margin-bottom: 0;
}

/* ---------- Blog listing ---------- */
.posts {
  display: grid;
  gap: 24px;
  max-width: 860px;
  margin-inline: auto;
}

/* Empty state shown while posts are unpublished (full text pending) */
.posts-empty {
  max-width: 860px;
  margin-inline: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(48px, 8vw, 88px) clamp(24px, 5vw, 48px);
  text-align: center;
  color: var(--body);
  font-size: 16px;
}
.posts-empty p {
  margin: 0;
}

.post-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(24px, 4vw, 40px);
  transition: border-color 0.2s ease, transform 0.2s ease;
}
.post-card:hover {
  border-color: var(--logo);
  transform: translateY(-2px);
}

.post-date {
  margin: 0 0 10px;
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--footer);
}

.post-card h2 {
  margin: 0 0 14px;
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(20px, 2.6vw, 26px);
  line-height: 1.3;
}
.post-card:hover h2 {
  color: var(--white);
}

.post-excerpt {
  margin: 0 0 18px;
  color: var(--body);
}

.continue-reading {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--white);
  font-size: 14px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.continue-reading::after {
  content: "";
  width: 22px;
  height: 1px;
  background: currentColor;
  transition: width 0.2s ease;
}
.post-card:hover .continue-reading::after {
  width: 34px;
}

/* ---------- Single post ---------- */
.post-article {
  max-width: 720px;
  margin-inline: auto;
}
.post-article .post-date {
  text-align: center;
}
.post-article h1 {
  margin: 0 0 28px;
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(28px, 4vw, 40px);
  line-height: 1.25;
  text-align: center;
}
.excerpt-note {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
}
.excerpt-label {
  display: inline-block;
  margin: 0 0 12px;
  padding: 3px 10px;
  border: 1px solid var(--logo);
  border-radius: 999px;
  color: var(--logo);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.excerpt-note > p {
  margin: 0 0 1.4em;
  font-size: 17px;
  color: var(--body);
}
.excerpt-note > p:last-child {
  margin-bottom: 0;
}
.post-missing {
  margin: 20px 0 0;
  padding: 18px 22px;
  border-left: 2px solid var(--logo);
  background: var(--surface);
  color: var(--footer);
  font-size: 14px;
  line-height: 1.6;
}

/* ---------- In The News ---------- */
.news-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-width: 820px;
  margin-inline: auto;
  counter-reset: news;
}
.news-list li {
  counter-increment: news;
  border-bottom: 1px solid var(--line);
}
.news-list li:last-child {
  border-bottom: none;
}
.news-list a {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 16px;
  align-items: baseline;
  padding: 20px 8px;
  color: var(--white);
}
.news-list a::before {
  content: counter(news, decimal-leading-zero);
  color: var(--footer);
  font-size: 13px;
  letter-spacing: 0.08em;
  font-variant-numeric: tabular-nums;
  transform: translateY(2px);
}
.news-list a:hover {
  color: var(--logo);
}
.news-list .news-arrow {
  display: none;
}

/* ---------- Contact ---------- */
.contact-form {
  max-width: 560px;
  margin-inline: auto;
  display: grid;
  gap: 22px;
}

.form-field label {
  display: block;
  margin-bottom: 8px;
  color: var(--white);
  font-size: 13px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.form-field input,
.form-field textarea {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  color: var(--white);
  font-family: var(--font-body);
  font-size: 16px;
  padding: 10px 2px;
  transition: border-color 0.2s ease;
}
.form-field textarea {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  resize: vertical;
}
.form-field input:focus,
.form-field textarea:focus {
  outline: none;
  border-color: var(--logo);
}

.form-actions {
  display: flex;
  justify-content: center;
}

.btn-submit {
  appearance: none;
  border: none;
  cursor: pointer;
  background: var(--white);
  color: #000;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 14px 44px;
  border-radius: 6px;
  transition: background 0.2s ease, transform 0.2s ease;
}
.btn-submit:hover {
  background: var(--logo);
  transform: translateY(-1px);
}

.form-legal {
  margin: 26px 0 0;
  text-align: center;
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--footer);
}
.form-legal a {
  color: var(--footer);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.form-legal a:hover {
  color: var(--white);
}

/* ---------- Social bar ---------- */
.social-section {
  padding: 64px 0 56px;
  text-align: center;
}

.social-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
  padding: 0;
  list-style: none;
}

.social-btn {
  position: relative;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  color: #fff;
  display: grid;
  place-items: center;
  text-decoration: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.social-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  color: #fff;
}
.social-btn svg {
  width: 18px;
  height: 18px;
  fill: #fff;
}

/* tooltip */
.social-btn::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  bottom: 100%;
  transform: translateX(-50%) translateY(4px);
  margin-bottom: 6px;
  padding: 4px 10px;
  background: #1a1a2e;
  color: #fff;
  font-size: 12.5px;
  white-space: nowrap;
  border-radius: 5px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.18s ease, transform 0.18s ease;
  pointer-events: none;
}
.social-btn:hover::after {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* ---------- Footer ---------- */
.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding-block: 28px;
}
.site-footer .footer-inner {
  text-align: center;
}
.site-footer p {
  margin: 0;
  color: var(--footer);
  font-size: 12px;
  letter-spacing: 0.06em;
}

/* ---------- 404 ---------- */
.error-page {
  min-height: 60vh;
  display: grid;
  place-items: center;
  text-align: center;
  padding-block: 80px;
}
.error-page h1 {
  margin: 0 0 12px;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: clamp(36px, 6vw, 64px);
}
.error-page p {
  margin: 0 0 28px;
  color: var(--body);
}
.error-page a.back-home {
  display: inline-block;
  border: 1px solid var(--logo);
  color: var(--logo);
  padding: 10px 28px;
  border-radius: 6px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-size: 13px;
}
.error-page a.back-home:hover {
  background: var(--logo);
  color: #000;
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .hero {
    grid-template-columns: 1fr;
  }
  .hero-media {
    max-width: 420px;
    margin-inline: auto;
  }
  .about-grid {
    grid-template-columns: 1fr;
  }
  .about-media {
    max-width: 380px;
    margin-inline: auto;
  }
}

@media (max-width: 767px) {
  .main-nav {
    display: none;
  }
  .nav-toggle {
    display: flex;
  }
  .mobile-nav.open {
    display: flex;
  }
  .header-inner {
    position: relative;
    justify-content: flex-end;
    padding-block: 14px;
  }
  .site-logo {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    font-size: 18px;
    padding: 6px 12px;
  }
  .news-list a {
    grid-template-columns: 34px 1fr;
    padding: 16px 4px;
  }
  /* Home bio sits directly below the stacked hero on small screens */
  .home-bio {
    padding-block: 8px 48px;
  }
}

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