/* ==========================================================================
   guotiexin.com — base stylesheet
   No framework, no build step. Design tokens first, then layout, then
   components, then responsive overrides, then print.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Design tokens
   -------------------------------------------------------------------------- */

:root {
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "Liberation Mono", monospace;

  /* Light theme — Gulf racing livery. Orange carries the identity and all
     interactive colour; Gulf blue is structural only (never a link), so the
     two never compete. Every text colour clears 4.5:1 on --bg. */
  --bg: #fbfcfd;
  --bg-subtle: #f3f6f9;
  --bg-elevated: #ffffff;
  --text: #15202b;
  --text-muted: #52616f;
  --text-faint: #65717d;
  --border: #e3e8ed;
  --border-strong: #c8d1da;
  --accent: #b4480a;
  --accent-hover: #9c4208;
  --accent-soft: #fdf0e8;
  --orange: #d9541a;
  --orange-text: #b4480a;
  --blue: #0a6ba8;
  --blue-text: #14577f;
  --blue-soft: #e7f1f8;
  --blue-border: #cfe2ef;
  --shadow-sm: 0 1px 2px rgba(16, 23, 34, 0.06);
  --shadow-md: 0 6px 20px -6px rgba(16, 23, 34, 0.16);

  /* Metrics */
  --w-text: 46rem;
  --w-wide: 68rem;
  --radius: 10px;
  --radius-sm: 6px;
  --header-h: 4rem;
}

:root[data-theme="dark"] {
  --bg: #101722;
  --bg-subtle: #16202c;
  --bg-elevated: #1a242f;
  --text: #e8edf2;
  --text-muted: #aab6c2;
  --text-faint: #8a97a3;
  --border: #26323f;
  --border-strong: #3a4857;
  --accent: #ff8a3d;
  --accent-hover: #ff9a52;
  --accent-soft: #2b1a0f;
  --orange: #ff8a3d;
  --orange-text: #ff9a52;
  --blue: #8fd0ee;
  --blue-text: #a6d8f0;
  --blue-soft: #17293a;
  --blue-border: #2d4355;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 6px 20px -6px rgba(0, 0, 0, 0.6);
}

/* Same tokens for visitors with JS disabled: follow the OS preference
   unless light was explicitly chosen. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #101722;
    --bg-subtle: #16202c;
    --bg-elevated: #1a242f;
    --text: #e8edf2;
    --text-muted: #aab6c2;
    --text-faint: #8a97a3;
    --border: #26323f;
    --border-strong: #3a4857;
    --accent: #ff8a3d;
    --accent-hover: #ff9a52;
    --accent-soft: #2b1a0f;
    --orange: #ff8a3d;
    --orange-text: #ff9a52;
    --blue: #8fd0ee;
    --blue-text: #a6d8f0;
    --blue-soft: #17293a;
    --blue-border: #2d4355;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 6px 20px -6px rgba(0, 0, 0, 0.6);
  }

  :root:not([data-theme="light"]) .btn--primary,
  :root:not([data-theme="light"]) .btn--primary:hover {
    color: #101722;
  }
}

/* --------------------------------------------------------------------------
   2. Reset and base
   -------------------------------------------------------------------------- */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 1rem);
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.7;
  font-feature-settings: "cv05" 1, "ss01" 1;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  line-height: 1.25;
  letter-spacing: -0.015em;
  font-weight: 650;
  text-wrap: balance;
}

h1 {
  font-size: clamp(2rem, 1.4rem + 2.4vw, 2.9rem);
  letter-spacing: -0.03em;
}

h2 {
  font-size: clamp(1.4rem, 1.2rem + 0.8vw, 1.7rem);
}

h3 {
  font-size: 1.1rem;
}

p,
ul,
ol {
  margin: 0 0 1rem;
}

ul,
ol {
  padding-left: 1.25rem;
}

li {
  margin-bottom: 0.3rem;
}

li::marker {
  color: var(--text-faint);
}

a {
  color: var(--accent);
  text-decoration-color: color-mix(in srgb, var(--accent) 35%, transparent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
}

a:hover {
  color: var(--accent-hover);
  text-decoration-color: currentColor;
}

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

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

hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 2.5rem 0;
}

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

/* --------------------------------------------------------------------------
   3. Layout primitives
   -------------------------------------------------------------------------- */

.wrap {
  width: 100%;
  max-width: var(--w-text);
  margin-inline: auto;
  padding-inline: 1.5rem;
}

.wrap--wide {
  max-width: var(--w-wide);
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  padding: 0.6rem 1rem;
  background: var(--accent);
  color: #fff;
  border-radius: 0 0 var(--radius-sm) 0;
}

.skip-link:focus {
  left: 0;
}

main {
  padding-block: 3.5rem 4rem;
}

section + section {
  margin-top: 3.5rem;
}

.section-title {
  position: relative;
  margin-bottom: 1.5rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border);
}

/* Short orange stripe over the rule — the Gulf livery cue. */
.section-title::after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 2.75rem;
  height: 2px;
  background: var(--blue);
}

/* --------------------------------------------------------------------------
   4. Header / navigation
   -------------------------------------------------------------------------- */

/* Thin blue-to-orange stripe across the top of every page. */
.site-header::before {
  content: "";
  display: block;
  height: 3px;
  background: linear-gradient(90deg, var(--orange) 0 64%, var(--blue) 64% 100%);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}

.nav {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: var(--header-h);
  max-width: var(--w-wide);
  margin-inline: auto;
  padding-inline: 1.5rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin-right: auto;
  font-weight: 650;
  letter-spacing: -0.02em;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}

.brand:hover {
  color: var(--text);
}

.brand img {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  flex: none;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav-links li {
  margin: 0;
}

.nav-links a {
  display: block;
  padding: 0.4rem 0.7rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.925rem;
  font-weight: 500;
  text-decoration: none;
}

.nav-links a:hover {
  background: var(--bg-subtle);
  color: var(--text);
}

.nav-links a[aria-current="page"] {
  color: var(--accent);
  background: var(--accent-soft);
}

.theme-toggle {
  display: none;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  margin-left: 0.4rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

/* Only useful with scripting enabled; the class is set by the inline
   head script. */
:root.js .theme-toggle {
  display: inline-grid;
}

.theme-toggle:hover {
  background: var(--bg-subtle);
  color: var(--text);
}

.theme-toggle svg {
  width: 1.05rem;
  height: 1.05rem;
}

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

/* --------------------------------------------------------------------------
   5. Hero
   -------------------------------------------------------------------------- */

.hero {
  padding-block: 1rem 0.5rem;
}

.hero .eyebrow {
  display: block;
  margin-bottom: 0.75rem;
  color: var(--orange-text);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hero h1 {
  margin-bottom: 0.75rem;
}

.hero .tagline {
  font-size: clamp(1.05rem, 1rem + 0.4vw, 1.2rem);
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  margin-bottom: 1.75rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.meta-row span,
.meta-row a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.meta-row svg {
  width: 1rem;
  height: 1rem;
  flex: none;
  color: var(--text-faint);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 0.5rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 1.1rem;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 0.925rem;
  font-weight: 550;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease,
    background 0.15s ease, border-color 0.15s ease;
}

.btn:hover {
  color: var(--text);
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.btn svg {
  width: 1rem;
  height: 1rem;
}

.btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn--primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: #fff;
}

:root[data-theme="dark"] .btn--primary,
:root[data-theme="dark"] .btn--primary:hover {
  color: #101722;
}

/* --------------------------------------------------------------------------
   6. Cards and grids
   -------------------------------------------------------------------------- */

.card-grid {
  display: grid;
  align-items: start;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  padding: 0;
  margin: 0;
  list-style: none;
}

.card-grid li {
  margin: 0;
}

.card {
  height: 100%;
  padding: 1.1rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-sm);
}

.card h3 {
  margin-bottom: 0.35rem;
  font-size: 1rem;
}

.card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.6;
}

.stat {
  display: block;
  font-size: 1.65rem;
  font-weight: 680;
  letter-spacing: -0.03em;
  line-height: 1.2;
  color: var(--orange-text);
}

.stat-label {
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* --------------------------------------------------------------------------
   7. Timeline (résumé)
   -------------------------------------------------------------------------- */

.timeline {
  list-style: none;
  margin: 0;
  padding: 0 0 0 1.5rem;
  border-left: 1px solid var(--border);
}

.timeline > li {
  position: relative;
  margin: 0 0 2rem;
  padding-left: 0.25rem;
}

.timeline > li:last-child {
  margin-bottom: 0;
}

.timeline > li::before {
  content: "";
  position: absolute;
  top: 0.55rem;
  left: -1.8rem;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--border-strong);
}

.timeline > li:first-child::before {
  background: var(--orange);
  border-color: var(--orange);
}

.entry-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 0.75rem;
  margin-bottom: 0.1rem;
}

.entry-head h3 {
  margin: 0;
  font-size: 1.075rem;
}

.entry-org {
  font-weight: 650;
}

.entry-role {
  color: var(--text-muted);
  font-weight: 450;
}

.entry-meta {
  margin-bottom: 0.5rem;
  color: var(--text-faint);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}

.entry-body {
  margin: 0;
  padding-left: 1.1rem;
  list-style: disc;
  color: var(--text-muted);
}

.entry-body li {
  margin-bottom: 0.35rem;
}

/* --------------------------------------------------------------------------
   8. Portfolio
   -------------------------------------------------------------------------- */

.project-grid {
  display: grid;
  align-items: start;
  gap: 1.25rem;
  grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr));
  margin: 0;
  padding: 0;
  list-style: none;
}

.project-grid > li {
  margin: 0;
}

.project {
  display: flex;
  flex-direction: column;
  padding: 1.35rem 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease,
    transform 0.15s ease;
}

.project:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.project h3 {
  margin-bottom: 0.1rem;
}

.project .entry-meta {
  margin-bottom: 0.75rem;
}

.project ul:not(.tags) {
  margin: 0 0 1rem;
  padding-left: 1.1rem;
  list-style: disc;
  color: var(--text-muted);
  font-size: 0.925rem;
}

.project > p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: auto 0 0;
  padding: 0;
  list-style: none;
}

.project .tags {
  margin-top: 0.25rem;
}

.tags li {
  margin: 0;
  padding: 0.15rem 0.55rem;
  border: 1px solid var(--blue-border);
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue-text);
  font-size: 0.75rem;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

/* --------------------------------------------------------------------------
   9. Misc content blocks
   -------------------------------------------------------------------------- */

.lead {
  font-size: 1.1rem;
  color: var(--text-muted);
}

.prose h3 {
  margin-top: 2rem;
  margin-bottom: 0.5rem;
}

.prose > :first-child {
  margin-top: 0;
}

.callout {
  padding: 1.1rem 1.35rem;
  border: 1px solid var(--border);
  border-left: 3px solid var(--blue);
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
}

.callout > :last-child {
  margin-bottom: 0;
}

.link-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.link-list li {
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border);
  margin: 0;
}

.link-list li:last-child {
  border-bottom: 0;
}

.plain-list {
  list-style: none;
  padding-left: 0;
}

.plain-list > li {
  padding-left: 1.1rem;
  position: relative;
}

.plain-list > li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.75em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--orange);
}

/* --------------------------------------------------------------------------
   10. Footer
   -------------------------------------------------------------------------- */

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--blue-soft);
  padding-block: 2rem;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: var(--w-wide);
  margin-inline: auto;
  padding-inline: 1.5rem;
}

.socials {
  display: flex;
  gap: 0.35rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.socials li {
  margin: 0;
}

.socials a {
  display: inline-grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
}

.socials a:hover {
  background: var(--bg-elevated);
  color: var(--accent);
}

.socials svg {
  width: 1.15rem;
  height: 1.15rem;
}

/* --------------------------------------------------------------------------
   11. Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 34rem) {
  :root {
    --header-h: 3.5rem;
  }

  .wrap,
  .nav,
  .footer-inner {
    padding-inline: 1.15rem;
  }

  .nav {
    gap: 0.25rem;
  }

  .brand span {
    display: none;
  }

  .nav-links a {
    padding-inline: 0.5rem;
    font-size: 0.875rem;
  }

  main {
    padding-block: 2.5rem 3rem;
  }

  .timeline {
    padding-left: 1.15rem;
  }

  .project {
    padding: 1.15rem 1.2rem;
  }
}

/* --------------------------------------------------------------------------
   12. Print — the résumé page should produce a clean PDF
   -------------------------------------------------------------------------- */

@media print {
  :root {
    --bg: #fff;
    --bg-subtle: #fff;
    --bg-elevated: #fff;
    --text: #000;
    --text-muted: #222;
    --text-faint: #444;
    --border: #bbb;
    --border-strong: #888;
    --accent: #000;
    --orange: #000;
    --orange-text: #000;
    --blue: #000;
    --blue-text: #000;
    --blue-soft: #fff;
    --blue-border: #bbb;
    --shadow-sm: none;
    --shadow-md: none;
  }

  .site-header,
  .site-footer,
  .actions,
  .print-hide {
    display: none !important;
  }

  body {
    font-size: 10.5pt;
    line-height: 1.45;
  }

  main {
    padding-block: 0;
  }

  .wrap {
    max-width: none;
    padding-inline: 0;
  }

  section + section {
    margin-top: 1.5rem;
  }

  /* Keep individual entries intact, but let long sections flow across
     pages — avoiding breaks inside a whole section wastes most of a page. */
  .timeline > li,
  .project,
  .card {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  h2,
  h3 {
    break-after: avoid;
    page-break-after: avoid;
  }

  .timeline > li {
    margin-bottom: 0.9rem;
  }

  /* The rail and dots sit outside the content box, which the page margin
     clips — drop them and let the entries read as a plain list. */
  .timeline {
    padding-left: 0;
    border-left: 0;
  }

  .timeline > li::before {
    display: none;
  }

  a {
    text-decoration: none;
  }
}
