/* -------------------------------------------------------------------------
   Lu Ding — personal homepage
   Fills the viewport on large screens; scrolls when content needs more room
   (phones / short viewports). Elements stack instead of overlapping.
   Style reference: nabr.com (minimalist split layout, off-white canvas,
   muted terracotta accent, airy geometric type).
   Type system: web-typography skill (readable body, measure, hierarchy).
   ---------------------------------------------------------------------- */

/* Geometric Latin face (self-hosted). CJK falls through to system fonts. */
@font-face {
  font-family: "Outfit";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../assets/fonts/outfit-latin-400.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Outfit";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../assets/fonts/outfit-latin-500.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Outfit";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../assets/fonts/outfit-latin-600.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Outfit";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../assets/fonts/outfit-latin-700.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --color-bg: #f7f4ef;
  --color-bg-alt: #f1e8dc;
  --color-ink: #262420;
  --color-ink-soft: #55524b;
  --color-accent: #b5713f;
  --color-accent-soft: #d9a06a;
  --color-line: rgba(38, 36, 32, 0.1);
  --color-card: #fffdfa;

  /* Outfit for Latin; PingFang / YaHei for 中文 — no external font CDN */
  --font-sans: "Outfit", "PingFang SC", "Helvetica Neue", "Segoe UI",
    "Microsoft YaHei", Arial, sans-serif;

  /* Type scale — web-typography: body ≥16–18px, clear hierarchy, fluid titles */
  --type-body: clamp(1.0625rem, 1rem + 0.25vw, 1.125rem); /* 17–18px */
  --type-secondary: 0.9375rem; /* 15px */
  --type-label: 0.8125rem; /* 13px */
  --type-title: clamp(1.25rem, 1.1rem + 0.6vw, 1.5rem);
  --type-display: clamp(1.5rem, 1.2rem + 1.2vw, 2rem);

  --maxw: 1180px;
  --gutter: clamp(16px, 3vw, 48px);
  --header-h: clamp(52px, 8vh, 72px);
}

* {
  box-sizing: border-box;
}

html {
  overflow-x: clip;
}

/* Avoid a brief English flash while auto language is applied */
html[data-i18n-pending] body {
  visibility: hidden;
}

/* If JS is disabled, keep the page visible */
html.no-js[data-i18n-pending] body {
  visibility: visible;
}

body {
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 100%;
  min-height: 100dvh;
  margin: 0;
  overflow-x: clip;
  font-family: var(--font-sans);
  font-size: var(--type-body);
  font-weight: 400;
  background: var(--color-bg);
  color: var(--color-ink);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.6;
}

a {
  color: inherit;
  text-decoration: none;
}

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

ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* ---------------------------------- Header ------------------------------ */

.site-header {
  width: 100%;
}

.site-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
  min-height: var(--header-h);
  max-width: var(--maxw);
  width: 100%;
  margin: 0 auto;
  padding: clamp(14px, 2vh, 20px) var(--gutter);
  overflow: hidden;
  /* Spans brand → language switch, but stays within the content max-width */
  background-image:
    linear-gradient(
      180deg,
      rgba(247, 244, 239, 0.84) 0%,
      rgba(247, 244, 239, 0.7) 55%,
      rgba(247, 244, 239, 0.8) 100%
    ),
    url("../assets/hero-paddy-field.jpg");
  background-size: cover;
  background-position: center 42%;
  background-repeat: no-repeat;
  box-shadow: 0 12px 32px -22px rgba(38, 36, 32, 0.4);
}

.wordmark {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  min-width: 0;
}

.wordmark-title {
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: var(--color-ink);
  text-wrap: balance;
}

.wordmark-subtitle {
  font-size: var(--type-label);
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1.4;
  color: var(--color-ink-soft);
}

.lang-switch {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 6px;
}

.lang-btn {
  margin: 0;
  padding: 4px 2px;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: var(--type-secondary);
  font-weight: 500;
  line-height: 1.35;
  color: var(--color-ink-soft);
  cursor: pointer;
  transition: color 0.2s ease;
}

.lang-btn:hover {
  color: var(--color-accent);
}

.lang-btn.is-active {
  color: var(--color-ink);
  font-weight: 700;
}

.lang-sep {
  font-size: 12px;
  color: var(--color-line);
  user-select: none;
}

/* ------------------------------------ Main ------------------------------ */

main {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: var(--maxw);
  width: 100%;
  margin: 0 auto;
  /* No horizontal padding — matches header-bar outer edges for footer align */
  padding: clamp(8px, 1.5vh, 20px) 0 clamp(12px, 2vh, 24px);
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(20px, 4vw, 56px);
  flex: 1 1 auto;
  align-items: stretch;
  width: 100%;
  max-width: 640px;
  margin-inline: auto;
  padding-inline: var(--gutter);
  box-sizing: border-box;
}

.content-left {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: clamp(16px, 2.5vh, 28px);
  min-width: 0;
  width: 100%;
}

.content-left .role {
  margin: 0;
  max-width: 28ch;
  font-size: var(--type-display);
  font-weight: 400;
  line-height: 1.25;
  letter-spacing: -0.02em;
  color: var(--color-accent);
  text-wrap: balance;
}

/* -------------------------------- App showcase --------------------------- */

.app-showcase {
  display: flex;
  flex-direction: column;
  gap: clamp(12px, 1.8vh, 18px);
  background: var(--color-bg-alt);
  border-radius: clamp(14px, 1.8vw, 20px);
  padding: clamp(14px, 2vh, 22px) clamp(14px, 2vw, 22px);
}

.apps-divider {
  width: 100%;
  height: 0;
  margin: 0;
  border: 0;
  border-top: 1px solid var(--color-line);
}

.app-card {
  display: flex;
  align-items: center;
  gap: clamp(12px, 1.8vw, 20px);
  min-width: 0;
}

.app-icon {
  flex-shrink: 0;
}

.app-icon img {
  width: clamp(56px, 7vw, 80px);
  height: clamp(56px, 7vw, 80px);
  border-radius: clamp(12px, 1.6vw, 18px);
  box-shadow: 0 12px 24px -10px rgba(38, 36, 32, 0.4);
}

.app-copy {
  min-width: 0;
  max-width: 42ch;
}

.app-copy h2 {
  margin: 0 0 4px;
  font-size: var(--type-title);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: var(--color-ink);
  text-wrap: balance;
}

.coming-soon {
  margin: 0;
  font-size: var(--type-body);
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1.6;
  text-transform: none;
  color: var(--color-ink-soft);
  opacity: 0.65;
}

.app-copy p {
  margin: 0 0 clamp(8px, 1.2vh, 12px);
  font-size: var(--type-body);
  font-weight: 400;
  color: var(--color-ink-soft);
  line-height: 1.6;
  letter-spacing: 0;
  max-width: 65ch;
}

.app-copy p:last-child {
  margin-bottom: 0;
}

.app-store-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--color-ink);
  color: #fff;
  padding: 8px 16px;
  border-radius: 12px;
  transition: transform 0.2s ease, background 0.2s ease;
}

.app-store-badge:hover {
  background: var(--color-accent);
  transform: translateY(-2px);
}

.app-store-badge--placeholder {
  cursor: default;
  opacity: 0.92;
  pointer-events: none;
}

.app-store-badge--placeholder:hover {
  background: var(--color-ink);
  transform: none;
}

.app-store-badge span {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  font-size: var(--type-secondary);
  font-weight: 600;
}

.app-store-badge small {
  font-size: 0.75rem;
  font-weight: 400;
  line-height: 1.3;
  opacity: 0.85;
}

/* ------------------------------------ Footer ----------------------------- */

.site-footer {
  flex-shrink: 0;
  align-self: stretch;
  width: 100%;
  max-width: none;
  margin-top: clamp(12px, 2vh, 20px);
  margin-inline: 0;
  /* Same inset as header-bar text; border spans full bar like the background */
  padding: clamp(12px, 1.8vh, 18px) var(--gutter) 0;
  border-top: 1px solid var(--color-line);
  text-align: start;
  box-sizing: border-box;
}

.site-footer h3 {
  margin: 0 0 clamp(10px, 1.5vh, 16px);
  font-size: var(--type-label);
  letter-spacing: 0;
  line-height: 1.3;
  color: var(--color-ink-soft);
  font-weight: 600;
}

.contact-list {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(10px, 1.5vh, 14px) clamp(20px, 3vw, 36px);
  margin-bottom: clamp(10px, 1.5vh, 16px);
}

.contact-list li {
  min-width: 0;
}

.contact-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: var(--type-body);
  font-weight: 500;
  line-height: 1.5;
  color: var(--color-ink);
  text-decoration: underline;
  text-decoration-thickness: from-font;
  text-underline-offset: 0.15em;
  border-bottom: 0;
  transition: color 0.2s ease;
}

.contact-link:hover {
  color: var(--color-accent);
}

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

.contact-icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  color: var(--color-ink-soft);
  transition: color 0.2s ease;
}

.contact-icon-app {
  border-radius: 4px;
  object-fit: cover;
}

.contact-link:hover .contact-icon {
  color: var(--color-accent);
}

.contact-label {
  font-size: inherit;
  color: inherit;
  opacity: 1;
}

.copyright {
  margin: 0;
  font-size: var(--type-label);
  line-height: 1.5;
  max-width: 65ch;
  color: var(--color-ink-soft);
  opacity: 0.7;
}

.copyright a {
  color: inherit;
  font-size: inherit;
  font-weight: inherit;
  text-decoration: none;
}

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

.icp {
  margin-top: 6px;
}

/* ------------------------------- Reveal animation ------------------------ */

.reveal {
  opacity: 1;
  transform: none;
}

/* ------------------------------------ Responsive -------------------------- */
/* Single centered column — no layout reflow when the viewport narrows.
   (Previously the page reflowed around a side theme picture; that is gone.) */

@media (max-width: 480px) {
  :root {
    --gutter: 16px;
  }
}
