/* =========================================================
   Han Xiaofan — COMSOL simulation notes
   ========================================================= */

:root {
  --paper: #f2f0ea;
  --ink: #191b1d;
  --muted: #686a6b;
  --muted-strong: #43484a;
  --line: rgba(25, 27, 29, 0.15);
  --line-strong: rgba(25, 27, 29, 0.3);
  --card: #ffffff;
  --accent: #285f99;
  --accent-deep: #1d4975;
  --accent-soft: #dce7f2;

  --font-sans: "Avenir Next", Avenir, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-mono: "SFMono-Regular", "Cascadia Code", "Liberation Mono", Consolas, monospace;

  --max-width: 1200px;
  --gutter: clamp(20px, 4vw, 52px);
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

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

* {
  margin: 0;
}

html {
  scroll-behavior: smooth;
  overflow-x: clip;
}

body {
  min-height: 100vh;
  overflow-x: clip;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

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

a {
  color: inherit;
}

::selection {
  background: var(--accent);
  color: #f8fbff;
}

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

.container {
  width: min(var(--max-width), calc(100% - var(--gutter) * 2));
  margin-inline: auto;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 20;
  padding: 9px 15px;
  border-radius: 7px;
  background: var(--ink);
  color: var(--paper);
  font-size: 12px;
  text-decoration: none;
  transform: translateY(-160%);
  transition: transform 0.2s var(--ease);
}

.skip-link:focus {
  transform: translateY(0);
}

/* ---------- Header ---------- */
.site-header {
  border-bottom: 1px solid var(--line);
}

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

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: none;
  border: 1px solid var(--ink);
  border-radius: 50%;
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.08em;
  transition: background-color 0.25s var(--ease), border-color 0.25s var(--ease), color 0.25s var(--ease);
}

.brand:hover .brand-mark {
  border-color: var(--accent);
  background: var(--accent);
  color: #f8fbff;
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  line-height: 1.2;
}

.brand-name {
  font-size: 14px;
  font-weight: 650;
  letter-spacing: 0.02em;
}

.brand-sub {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.header-meta {
  display: flex;
  align-items: center;
  gap: 26px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.1em;
  line-height: 1.5;
  text-align: right;
  text-transform: uppercase;
}

.header-meta span + span::before {
  content: "";
  display: inline-block;
  width: 3px;
  height: 3px;
  margin-right: 26px;
  border-radius: 50%;
  background: var(--accent);
  vertical-align: 2px;
}

/* ---------- Introduction ---------- */
.intro {
  padding-block: clamp(54px, 7.5vw, 100px) clamp(54px, 7vw, 80px);
  background:
    radial-gradient(circle at 82% 4%, rgba(40, 95, 153, 0.055), transparent 38%),
    var(--paper);
}

.intro-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: 0.13em;
  line-height: 1.6;
  text-transform: uppercase;
}

.intro-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 350px);
  align-items: end;
  gap: clamp(42px, 7vw, 100px);
  margin-top: clamp(48px, 7vw, 84px);
}

.page-title {
  font-size: clamp(3.25rem, 7vw, 6.4rem);
  font-weight: 700;
  letter-spacing: -0.06em;
  line-height: 1.04;
  text-wrap: balance;
}

.title-accent {
  color: var(--accent);
}

.intro-side {
  justify-self: end;
  max-width: 350px;
}

.intro-description {
  color: var(--muted-strong);
  font-size: 14.5px;
  line-height: 1.95;
}

/* Technical specs */
.specs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: clamp(46px, 6vw, 72px);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.spec {
  min-width: 0;
  padding: clamp(17px, 2vw, 22px) clamp(14px, 2vw, 22px);
  border-left: 1px solid var(--line);
}

.spec:first-child {
  padding-left: 0;
  border-left: 0;
}

.spec:last-child {
  padding-right: 0;
}

.spec dt {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.12em;
  line-height: 1.5;
  text-transform: uppercase;
}

.spec dd {
  margin-top: 8px;
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.45;
}

/* ---------- Simulation entries ---------- */
.gallery {
  border-top: 1px solid var(--line);
}

.sim-entry {
  display: grid;
  grid-template-columns: minmax(0, 1.42fr) minmax(260px, 0.58fr);
  align-items: center;
  gap: clamp(38px, 6.5vw, 92px);
  padding-block: clamp(54px, 7vw, 96px);
}

.sim-entry + .sim-entry {
  border-top: 1px solid var(--line);
}

.sim-entry--reverse {
  grid-template-columns: minmax(260px, 0.58fr) minmax(0, 1.42fr);
}

.sim-entry--reverse .sim-figure {
  order: 2;
}

.sim-entry--reverse .sim-copy {
  order: 1;
}

.sim-figure {
  min-width: 0;
}

.sim-print {
  padding: clamp(7px, 0.8vw, 11px);
  border: 1px solid var(--line);
  background: var(--card);
  box-shadow: 0 18px 45px rgba(25, 35, 48, 0.075);
}

.sim-image {
  width: 100%;
  height: auto;
  background: #ffffff;
}

.sim-figcaption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 12px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 7.5px;
  letter-spacing: 0.09em;
  line-height: 1.5;
  text-transform: uppercase;
}

.sim-copy {
  align-self: center;
  max-width: 330px;
}

.sim-kicker {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: 0.11em;
  line-height: 1.5;
  text-transform: uppercase;
}

.sim-kicker::before {
  content: "";
  width: 23px;
  height: 1px;
  flex: none;
  background: currentColor;
}

.sim-copy h2 {
  margin-top: 17px;
  font-size: clamp(2rem, 3.2vw, 3rem);
  font-weight: 650;
  letter-spacing: -0.045em;
  line-height: 1.2;
  text-wrap: balance;
}

.sim-description {
  margin-top: 20px;
  color: var(--muted-strong);
  font-size: 14px;
  line-height: 1.95;
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  padding-block: 27px 40px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.05em;
  line-height: 1.7;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.footer-meta {
  text-align: center;
}

.back-top {
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.2s var(--ease);
}

.back-top:hover {
  color: var(--accent);
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .intro-main {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .intro-side {
    justify-self: start;
    max-width: 620px;
  }

  .sim-entry,
  .sim-entry--reverse {
    grid-template-columns: 1fr;
    gap: 27px;
    padding-block: clamp(46px, 7vw, 72px);
  }

  .sim-entry--reverse .sim-figure {
    order: 0;
  }

  .sim-entry--reverse .sim-copy {
    order: 1;
  }

  .sim-copy {
    max-width: 620px;
  }
}

@media (max-width: 720px) {
  .specs {
    grid-template-columns: 1fr 1fr;
  }

  .spec {
    padding: 15px 16px;
  }

  .spec:first-child {
    padding-left: 0;
  }

  .spec:nth-child(odd) {
    padding-left: 0;
    border-left: 0;
  }

  .spec:nth-child(even) {
    padding-right: 0;
  }

  .spec:nth-child(n + 3) {
    border-top: 1px solid var(--line);
  }
}

@media (max-width: 640px) {
  .header-inner {
    min-height: 72px;
    padding-block: 16px;
  }

  .brand {
    gap: 9px;
  }

  .brand-mark {
    width: 36px;
    height: 36px;
    font-size: 7px;
  }

  .header-meta {
    gap: 0;
  }

  .header-meta span:first-child,
  .header-meta span + span::before {
    display: none;
  }

  .intro {
    padding-block: 42px 54px;
  }

  .intro-top {
    align-items: flex-start;
    flex-direction: column;
    gap: 7px;
    padding-bottom: 15px;
  }

  .intro-main {
    gap: 27px;
    margin-top: 38px;
  }

  .page-title {
    font-size: clamp(2.6rem, 11.8vw, 4rem);
    letter-spacing: -0.06em;
  }

  .intro-description {
    font-size: 13.5px;
    line-height: 1.9;
  }

  .specs {
    margin-top: 38px;
  }

  .spec {
    padding: 13px 12px;
  }

  .spec dd {
    font-size: 12.5px;
  }

  .sim-entry,
  .sim-entry--reverse {
    gap: 20px;
    padding-block: 42px;
  }

  .sim-print {
    padding: 6px;
    box-shadow: 0 12px 28px rgba(25, 35, 48, 0.07);
  }

  .sim-figcaption {
    gap: 12px;
    margin-top: 10px;
    font-size: 6.8px;
  }

  .sim-copy h2 {
    margin-top: 14px;
    font-size: clamp(1.8rem, 8vw, 2.35rem);
  }

  .sim-description {
    margin-top: 15px;
    font-size: 13.5px;
    line-height: 1.9;
  }

  .site-footer {
    padding-block: 23px 32px;
  }

  .footer-inner {
    flex-wrap: wrap;
    gap: 10px 20px;
  }

  .footer-meta {
    text-align: left;
  }

  .back-top {
    margin-left: auto;
  }
}

@media (max-width: 390px) {
  .brand-sub {
    display: none;
  }

  .sim-figcaption span:last-child {
    text-align: right;
  }
}

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

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
