/* CaelbertChae.com — Homepage responsive layout
   The desktop composition remains the baseline; mobile rules are isolated below. */

:root {
  --bg-a: #fff;
  --bg-b: #fbfbfd;
  --glow: rgba(180, 190, 205, .10);
  --ink: #1d1d1f;
  --muted: #6e6e73;
  --soft: #86868b;
  --brand-text: #8e8e93;
  --line: rgba(29, 29, 31, .11);
  --panel: rgba(255, 255, 255, .90);
}

html[data-period="morning"] { --bg-a:#fffaf2; --bg-b:#f8f3ea; --glow:rgba(231,184,112,.17); }
html[data-period="day"] { --bg-a:#fff; --bg-b:#fbfbfd; --glow:rgba(180,190,205,.10); }
html[data-period="evening"] { --bg-a:#faedd8; --bg-b:#e9cb94; --glow:rgba(202,139,54,.20); }

html[data-period="night"] {
  color-scheme: dark;
  --bg-a:#000;
  --bg-b:#1c1c1e;
  --glow:rgba(255,255,255,.04);
  --ink:#f5f5f7;
  --muted:#a1a1a6;
  --soft:#86868b;
  --brand-text:#86868b;
  --line:rgba(245,245,247,.14);
  --panel:rgba(28,28,30,.88);
}

* { box-sizing: border-box; }

html,
body {
  min-width: 1200px;
  min-height: 100%;
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", sans-serif;
}

body {
  color: var(--ink);
  background:
    radial-gradient(circle at 17% 24%, var(--glow), transparent 37%),
    linear-gradient(135deg, var(--bg-a), var(--bg-b));
  transition: background .45s ease, color .45s ease;
}

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

a { text-decoration: none; }
button { border: 0; }

.shell {
  width: 100%;
  max-width: 1280px;
  margin-inline: auto;
  padding-inline: 48px;
}

.page {
  min-height: 100vh;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: 38px;
  display: flex;
  align-items: center;
  background: transparent;
  border-bottom: 1px solid transparent;
  transition:
    background .24s ease,
    border-color .24s ease,
    box-shadow .24s ease;
}

.site-header.is-scrolled {
  background: color-mix(in srgb, var(--panel) 84%, transparent);
  border-bottom-color: var(--line);
  box-shadow: 0 1px 0 rgba(0, 0, 0, .015);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 15px;
  font-weight: 400;
  letter-spacing: -.01em;
}

.brand-logo {
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
}

.brand span {
  color: var(--brand-text);
  transition: color .2s ease;
}

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

.primary-nav {
  display: flex;
  align-items: center;
  gap: 29px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
}

.primary-nav button {
  padding: 0;
  background: none;
  cursor: pointer;
}

.primary-nav a,
.primary-nav button { transition: color .18s ease; }

.primary-nav a:hover,
.primary-nav button:hover { color: var(--ink); }

.nav-toggle { display: none; }

/* Hero */
.hero {
  max-width: 1152px;
  min-height: calc(100vh - 38px);
  padding-top: 20px;
  padding-bottom: 24px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: 80px;
}

.logo-stage {
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero-logo {
  width: 224px;
  height: 224px;
  transition: transform .7s ease;
}

.hero-logo:hover { transform: scale(1.04); }

.quote-stage { min-width: 0; }

.quote {
  position: relative;
  padding-inline: 4px;
  font-family: Georgia, "Times New Roman", "Songti SC", "STSong", serif;
}

.quote-mark {
  position: absolute;
  left: -40px;
  top: -54px;
  color: var(--line);
  font-size: 104px;
  line-height: 1;
  user-select: none;
}

.quote p { margin: 0; color: var(--muted); }

.quote .one {
  font-size: 38px;
  line-height: 1.45;
  letter-spacing: .01em;
}

.quote .focus {
  margin: 11px 0 26px;
  color: var(--ink);
  font-size: 52px;
  line-height: 1.2;
  font-style: italic;
}

.quote .close {
  font-size: 30px;
  line-height: 1.75;
}

.quote-zh {
  padding: 38px 42px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 48%, transparent);
}

.quote-zh .one { font-size:18px; letter-spacing:.32em; }
.quote-zh .focus { font-size:48px; letter-spacing:.1em; font-style:normal; }
.quote-zh .close { font-size:27px; line-height:1.9; letter-spacing:.15em; }


/* Screen 2 — Personal coordinate */
.coordinate-screen {
  min-height: 100vh;
  display: grid;
  align-items: center;
  overflow: hidden;
}

.coordinate-inner {
  width: 100%;
  max-width: 1280px;
  padding-top: 74px;
  padding-bottom: 86px;
}

.coordinate-canvas {
  position: relative;
  width: 100%;
  height: 660px;
}

.coordinate-art {
  position: absolute;
  inset: 12px 10px 18px;
  width: calc(100% - 20px);
  height: calc(100% - 30px);
  color: #0354FC;
  overflow: visible;
}

.coordinate-guides path {
  fill: none;
  stroke: var(--line);
  stroke-width: 1.2;
  stroke-linecap: round;
}

.coordinate-flow path {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.flow-soft {
  stroke-width: 1.35;
  opacity: .16;
}

.flow-main {
  stroke-width: 3.2;
  opacity: .98;
}

.flow-accent {
  stroke-width: 1.6;
  opacity: .34;
}

.coordinate-label {
  position: absolute;
  color: var(--muted);
  font-size: 11px;
  line-height: 1;
  letter-spacing: .18em;
  font-weight: 600;
}

.coordinate-think {
  top: 66px;
  left: 48.4%;
}

.coordinate-build {
  top: 205px;
  right: 45px;
}

.coordinate-live {
  left: 42px;
  bottom: 132px;
}

.coordinate-caption {
  position: absolute;
  right: 44px;
  bottom: 42px;
  margin: 0;
  color: var(--soft);
  font-family: Georgia, "Times New Roman", "Songti SC", "STSong", serif;
  font-size: 15px;
  line-height: 1.5;
  letter-spacing: .01em;
}

.coordinate-screen:hover .flow-main {
  stroke-width: 3.6;
}

.coordinate-screen:hover .coordinate-art {
  transform: translateY(-2px);
}

.coordinate-art,
.flow-main {
  transition: transform .8s ease, stroke-width .8s ease;
}

/* Screen 3 — One thought */
.thought-screen {
  min-height: 92vh;
  display: grid;
  align-items: center;
}

.thought-screen-inner {
  width: 100%;
  max-width: 1152px;
  padding-top: 96px;
  padding-bottom: 112px;
}

.thought {
  max-width: 980px;
}

.thought p {
  margin: 0;
  color: var(--ink);
  font-family: Georgia, "Times New Roman", "Songti SC", "STSong", serif;
  font-size: 58px;
  line-height: 1.22;
  letter-spacing: -.025em;
  font-weight: 400;
}

.thought time {
  display: block;
  margin-top: 34px;
  color: var(--soft);
  font-size: 12px;
  line-height: 1.4;
  letter-spacing: .045em;
}

.thought-zh p {
  font-size: 54px;
  line-height: 1.42;
  letter-spacing: .025em;
}

/* Footer */
.site-footer {
  padding-bottom: 16px;
  color: var(--soft);
  font-size: 11px;
}

.footer-inner {
  padding-top: 52px;
  border-top: 1px solid var(--line);
}

.footer-columns {
  margin-bottom: 54px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: start;
  gap: 48px;
}

.footer-column { min-width: 0; }
.footer-logo-column { padding-top: 1px; }

.footer-logo {
  width: 28px;
  height: 28px;
}

.footer-title {
  display: block;
  margin-bottom: 7px;
  color: var(--ink);
  font-size: 11px;
  font-weight: 600;
}

.footer-links {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
}

.footer-links a,
.footer-static {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  transition: color .18s ease;
}

.footer-links a:hover {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.footer-bottom {
  padding-top: 14px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 18px;
  color: var(--soft);
  line-height: 1.35;
}

.footer-legal,
.footer-lang {
  display: flex;
  align-items: center;
}

.footer-legal a,
.footer-lang button {
  position: relative;
  color: var(--soft);
  background: none;
  transition: color .18s ease;
}

.footer-legal a { padding-inline: 9px; }
.footer-legal a:first-child { padding-left: 0; }

.footer-legal a + a::before,
.footer-lang button + button::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 1px;
  height: 11px;
  background: var(--line);
  transform: translateY(-50%);
}

.footer-legal a:hover,
.footer-lang button:hover { color: var(--ink); }

.footer-legal a:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.footer-lang {
  margin-left: auto;
  white-space: nowrap;
}

.footer-lang button {
  padding-inline: 8px;
  cursor: pointer;
  font-size: 11px;
}

.footer-lang button:first-child { padding-left: 0; }
.footer-lang button:last-child { padding-right: 0; }

.footer-lang button.active {
  color: var(--ink);
  font-weight: 600;
}

/* Resume dialog */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  place-items: center;
  padding: 24px;
  background: rgba(0,0,0,.38);
  backdrop-filter: blur(7px);
}

.modal.open { display: grid; }

.dialog {
  width: 360px;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: 0 22px 60px rgba(0,0,0,.18);
}

.dialog h2 { margin:0 0 7px; font-size:20px; }
.dialog p { margin:0 0 22px; color:var(--muted); font-size:14px; }

.dialog input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: transparent;
  outline: none;
}

.actions {
  margin-top: 22px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.actions button {
  padding: 9px 16px;
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
}

.actions .submit {
  color: #fff;
  background: #0071e3;
}


.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

body.modal-open {
  overflow: hidden;
}

[hidden] { display: none !important; }

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

/* Handheld and compact tablet layout */
@media (max-width: 900px) {
  html,
  body {
    min-width: 0;
    overflow-x: clip;
  }

  .shell {
    max-width: none;
    padding-inline: clamp(20px, 6vw, 32px);
  }

  .site-header {
    height: calc(52px + env(safe-area-inset-top));
    padding-top: env(safe-area-inset-top);
  }

  .header-inner {
    position: relative;
    height: 52px;
  }

  .brand {
    min-height: 44px;
    gap: 8px;
    font-size: 14px;
  }

  .nav-toggle {
    position: relative;
    display: grid;
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    place-content: center;
    gap: 5px;
    padding: 0;
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  .nav-toggle span {
    width: 18px;
    height: 1.5px;
    border-radius: 999px;
    background: currentColor;
    transform-origin: center;
    transition: transform .22s ease, opacity .18s ease;
  }

  .site-header.is-menu-open .nav-toggle span:first-child {
    transform: translateY(3.25px) rotate(45deg);
  }

  .site-header.is-menu-open .nav-toggle span:last-child {
    transform: translateY(-3.25px) rotate(-45deg);
  }

  .primary-nav {
    position: absolute;
    top: calc(100% + 8px);
    right: clamp(20px, 6vw, 32px);
    left: clamp(20px, 6vw, 32px);
    display: grid;
    gap: 0;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: color-mix(in srgb, var(--panel) 94%, transparent);
    box-shadow: 0 18px 48px rgba(0, 0, 0, .12);
    backdrop-filter: blur(22px) saturate(150%);
    -webkit-backdrop-filter: blur(22px) saturate(150%);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-8px);
    transition: opacity .2s ease, transform .2s ease, visibility .2s;
  }

  .site-header.is-menu-open .primary-nav {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
  }

  .primary-nav a,
  .primary-nav button {
    display: flex;
    min-height: 46px;
    align-items: center;
    padding: 0 14px;
    border-radius: 11px;
    text-align: left;
  }

  .primary-nav a:active,
  .primary-nav button:active,
  .nav-toggle:active {
    background: color-mix(in srgb, var(--ink) 8%, transparent);
  }

  .brand:focus-visible,
  .nav-toggle:focus-visible,
  .primary-nav a:focus-visible,
  .primary-nav button:focus-visible,
  .footer-links a:focus-visible,
  .footer-legal a:focus-visible,
  .footer-lang button:focus-visible {
    outline: 2px solid #0354FC;
    outline-offset: 2px;
  }

  .hero {
    min-height: calc(100svh - 52px - env(safe-area-inset-top));
    padding-top: clamp(34px, 7vh, 64px);
    padding-bottom: clamp(52px, 9vh, 84px);
    grid-template-columns: minmax(0, 1fr);
    align-content: center;
    align-items: center;
    gap: clamp(34px, 7vh, 58px);
  }

  .hero-logo {
    width: clamp(112px, 31vw, 148px);
    height: clamp(112px, 31vw, 148px);
  }

  .hero-logo:hover { transform: none; }

  .quote-stage {
    width: 100%;
    max-width: 520px;
    margin-inline: auto;
  }

  .quote {
    padding-inline: 0;
  }

  .quote-mark {
    left: -13px;
    top: -37px;
    font-size: 72px;
  }

  .quote .one {
    font-size: clamp(21px, 6vw, 29px);
    line-height: 1.38;
  }

  .quote .focus {
    margin: 8px 0 18px;
    font-size: clamp(34px, 9.5vw, 44px);
    line-height: 1.14;
  }

  .quote .close {
    font-size: clamp(18px, 5vw, 23px);
    line-height: 1.62;
  }

  .quote-zh {
    padding: clamp(24px, 7vw, 34px) clamp(20px, 6vw, 30px);
  }

  .quote-zh .one {
    font-size: 15px;
    line-height: 1.7;
    letter-spacing: .2em;
  }

  .quote-zh .focus {
    margin-block: 14px 18px;
    font-size: clamp(31px, 9vw, 40px);
    line-height: 1.3;
    letter-spacing: .07em;
  }

  .quote-zh .close {
    font-size: clamp(19px, 5.5vw, 24px);
    line-height: 1.75;
    letter-spacing: .1em;
  }

  .coordinate-screen {
    min-height: 100svh;
  }

  .coordinate-inner {
    padding-top: clamp(68px, 10vh, 96px);
    padding-bottom: clamp(72px, 11vh, 104px);
  }

  .coordinate-canvas {
    height: clamp(440px, 66vh, 560px);
  }

  .coordinate-art {
    inset: 28px auto auto 50%;
    width: clamp(680px, 185vw, 820px);
    height: auto;
    aspect-ratio: 1120 / 620;
    transform: translateX(-50%);
  }

  .coordinate-screen:hover .coordinate-art {
    transform: translateX(-50%);
  }

  .coordinate-screen:hover .flow-main {
    stroke-width: 3.2;
  }

  .coordinate-label {
    font-size: 10px;
  }

  .coordinate-think {
    top: 30px;
    left: 50%;
    transform: translateX(-50%);
  }

  .coordinate-build {
    top: 45%;
    right: 4px;
  }

  .coordinate-live {
    left: 4px;
    bottom: 24%;
  }

  .coordinate-caption {
    right: 4px;
    bottom: 18px;
    max-width: 230px;
    font-size: 14px;
    text-align: right;
  }

  .thought-screen {
    min-height: 86svh;
  }

  .thought-screen-inner {
    padding-top: clamp(80px, 13vh, 120px);
    padding-bottom: clamp(96px, 15vh, 140px);
  }

  .thought p,
  .thought-zh p {
    font-size: clamp(34px, 9.5vw, 48px);
    line-height: 1.27;
    letter-spacing: -.025em;
  }

  .thought-zh p {
    line-height: 1.5;
    letter-spacing: .02em;
  }

  .thought time {
    margin-top: 26px;
  }

  .site-footer {
    padding-bottom: max(22px, env(safe-area-inset-bottom));
  }

  .footer-inner {
    padding-top: 36px;
  }

  .footer-columns {
    margin-bottom: 42px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 34px 24px;
  }

  .footer-logo-column {
    grid-column: 1 / -1;
    padding: 0 0 2px;
  }

  .footer-logo {
    width: 30px;
    height: 30px;
  }

  .footer-title {
    margin-bottom: 9px;
    font-size: 12px;
  }

  .footer-links {
    gap: 0;
  }

  .footer-links a,
  .footer-static {
    display: flex;
    min-height: 34px;
    align-items: center;
    font-size: 13px;
  }

  .footer-bottom {
    align-items: flex-start;
    flex-direction: column;
    gap: 16px;
  }

  .footer-legal {
    flex-wrap: wrap;
    gap: 6px 18px;
  }

  .footer-legal a {
    min-height: 32px;
    display: flex;
    align-items: center;
    padding: 0;
    font-size: 12px;
  }

  .footer-legal a + a::before {
    display: none;
  }

  .footer-lang {
    margin-left: 0;
  }

  .footer-lang button {
    min-height: 44px;
    font-size: 12px;
  }

  .dialog {
    width: min(100%, 390px);
    padding: 24px;
    border-radius: 16px;
  }

  .dialog input {
    min-height: 48px;
    font-size: 16px;
  }

  .actions button {
    min-height: 44px;
  }
}

@media (max-width: 370px) {
  .brand span { max-width: 132px; }

  .quote-mark { left: -8px; }

  .footer-columns { column-gap: 18px; }
}

@media (max-width: 900px) and (max-height: 520px) and (orientation: landscape) {
  .hero {
    min-height: auto;
    padding-top: 48px;
    padding-bottom: 64px;
    grid-template-columns: .7fr 1.3fr;
    gap: 36px;
  }

  .hero-logo {
    width: 108px;
    height: 108px;
  }

  .quote .one { font-size: 20px; }
  .quote .focus { font-size: 32px; }
  .quote .close { font-size: 18px; line-height: 1.5; }

  .coordinate-screen,
  .thought-screen {
    min-height: 620px;
  }
}
