:root {
  color-scheme: dark;
  --ink: #062027;
  --deep: #0c3a43;
  --teal: #138b87;
  --foam: #f0fff9;
  --mist: #b9e7de;
  --gold: #ffe18b;
  --line: rgba(240, 255, 249, 0.22);
  --nav-width: 176px;
  --page-bg: url("assets/backgrounds/natural-ocean-hero.png");
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  scroll-behavior: smooth;
  scroll-snap-type: y mandatory;
}

body {
  min-height: 100%;
  margin: 0;
  max-width: 100vw;
  color: var(--foam);
  background: var(--ink);
  font-family: "Segoe UI", "Noto Sans TC", "Microsoft JhengHei", Arial, sans-serif;
  line-height: 1.5;
  overflow-x: hidden;
}

body.nav-open {
  overflow: hidden;
}

a {
  color: inherit;
}

.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;
}

.reef-canvas {
  position: fixed;
  inset: 0;
  z-index: 2;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  opacity: 0.28;
  mix-blend-mode: screen;
}

.site-header {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  display: grid;
  align-items: center;
  width: var(--nav-width);
  padding: 36px 22px;
  pointer-events: none;
}

.site-nav {
  display: grid;
  gap: 10px;
  pointer-events: auto;
}

.site-nav a {
  display: flex;
  align-items: center;
  min-height: 38px;
  padding: 6px 0 6px 12px;
  border-left: 2px solid rgba(240, 255, 249, 0.22);
  color: rgba(240, 255, 249, 0.78);
  font-size: 0.95rem;
  font-weight: 900;
  text-decoration: none;
  transition: color 160ms ease, border-color 160ms ease, padding-left 160ms ease;
}

.site-nav a:hover,
.site-nav a.is-active {
  padding-left: 18px;
  border-left-color: var(--gold);
  color: var(--gold);
}

.nav-toggle {
  display: none;
  width: 44px;
  height: 44px;
  padding: 10px;
  border: 1px solid rgba(240, 255, 249, 0.52);
  border-radius: 8px;
  color: var(--foam);
  background: rgba(6, 32, 39, 0.72);
}

.nav-toggle span:not(.sr-only) {
  display: block;
  width: 100%;
  height: 2px;
  margin: 4px 0;
  background: currentColor;
}

.fullpage {
  position: relative;
  z-index: 1;
}

.page-section {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 100vh;
  height: 100vh;
  overflow: hidden;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  padding: 52px clamp(28px, 4vw, 72px) 52px calc(var(--nav-width) + clamp(34px, 4vw, 80px));
}

.page-section::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  background-image: var(--page-bg);
  background-size: cover;
  background-position: center right;
  filter: saturate(1.02) contrast(1.02);
}

.page-section::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(90deg, rgba(6, 32, 39, 0.92), rgba(6, 32, 39, 0.64), rgba(6, 32, 39, 0.28)),
    linear-gradient(180deg, rgba(6, 32, 39, 0.14), rgba(6, 32, 39, 0.84));
}

.about-page::after,
.experience-page::after,
.education-page::after,
.skills-page::after,
.contact-page::after {
  background:
    linear-gradient(90deg, rgba(7, 44, 51, 0.94), rgba(7, 44, 51, 0.78), rgba(7, 44, 51, 0.34)),
    linear-gradient(180deg, rgba(9, 69, 75, 0.16), rgba(6, 32, 39, 0.9));
}

.projects-page::after,
.publish-page::after,
.travel-page::after {
  background:
    linear-gradient(90deg, rgba(6, 32, 39, 0.92), rgba(8, 59, 64, 0.68), rgba(6, 32, 39, 0.28)),
    linear-gradient(180deg, rgba(255, 225, 139, 0.06), rgba(6, 32, 39, 0.86));
}

.section-shell {
  position: relative;
  z-index: 6;
  width: min(1140px, 100%);
  min-width: 0;
  margin: 0 auto;
}

.hero-grid,
.about-layout,
.paper-layout,
.travel-layout,
.contact-layout,
.timeline-layout {
  display: grid;
  align-items: center;
  gap: clamp(26px, 4vw, 60px);
  min-width: 0;
}

.hero-grid {
  grid-template-columns: minmax(0, 0.92fr) minmax(280px, 0.7fr);
  grid-template-areas: "main photo";
  column-gap: clamp(34px, 5vw, 70px);
}

.hero-main {
  grid-area: main;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 24px;
}

.hero-copy {
  justify-self: center;
  max-width: 660px;
  min-width: 0;
  text-align: center;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

.hero-photo {
  grid-area: photo;
  justify-self: end;
  width: min(400px, 100%);
  aspect-ratio: 0.72;
  margin: 0;
  overflow: hidden;
  border: 1px solid rgba(240, 255, 249, 0.28);
  border-radius: 8px;
  background: rgba(6, 32, 39, 0.28);
}

.hero-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
}

.about-layout,
.paper-layout,
.travel-layout,
.contact-layout,
.timeline-layout {
  grid-template-columns: minmax(240px, 0.52fr) minmax(0, 1fr);
}

.section-head {
  max-width: 560px;
}

.compact {
  max-width: 720px;
  margin: 0 auto;
  text-align: center;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--gold);
  font-size: 1rem;
  font-weight: 900;
  line-height: 1.15;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
  overflow-wrap: anywhere;
}

h1,
h2 {
  margin-bottom: 0;
  color: var(--foam);
  line-height: 1;
}

h1 span {
  display: block;
  font-size: 5.8rem;
}

h1 em {
  display: block;
  margin-top: 10px;
  color: rgba(240, 255, 249, 0.74);
  font-size: 1.96rem;
  font-style: normal;
  font-weight: 900;
}

h2 {
  font-size: 4rem;
}

.hero-lead,
.section-head > p:not(.eyebrow),
.about-copy,
.timeline-list p,
.skill-reef p,
.project-grid p,
.paper-panel p {
  color: rgba(240, 255, 249, 0.8);
}

.hero-lead {
  max-width: 620px;
  margin: 18px auto 0;
  font-size: 1.1rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 900;
}

.button.primary {
  color: #062027;
  background: var(--gold);
}

.button.ghost {
  color: var(--foam);
  border-color: rgba(240, 255, 249, 0.34);
  background: rgba(240, 255, 249, 0.08);
}

.about-copy {
  padding-left: 26px;
  border-left: 2px solid var(--gold);
  font-size: 1.2rem;
  line-height: 1.75;
}

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

.timeline-list {
  display: grid;
  border-top: 1px solid var(--line);
}

.timeline-list article {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr);
  gap: 24px;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}

.timeline-list time,
.skill-reef span,
.project-grid span,
.paper-venue,
.photo-tag,
.contact-lines span {
  color: var(--gold);
  font-size: 0.92rem;
  font-weight: 900;
  line-height: 1.15;
  text-transform: uppercase;
}

.timeline-list h3,
.skill-reef h3,
.project-grid h3,
.paper-panel h3 {
  margin-bottom: 0;
  color: var(--foam);
  line-height: 1.16;
}

.timeline-list h3 {
  font-size: 1.18rem;
}

.timeline-list p {
  margin: 8px 0 0;
  font-size: 0.98rem;
}

.skill-reef,
.project-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 28px;
}

.skill-reef article,
.project-grid article {
  min-height: 116px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(6, 32, 39, 0.24);
}

.skill-reef h3,
.project-grid h3 {
  margin-top: 14px;
  font-size: 1.02rem;
}

.skill-reef p,
.project-grid p {
  margin: 10px 0 0;
  font-size: 0.92rem;
  line-height: 1.45;
}

.project-grid h3 a,
.paper-panel h3 a {
  color: inherit;
  text-decoration: none;
  text-decoration-thickness: 2px;
  text-underline-offset: 6px;
}

.project-grid h3 a:hover,
.project-grid h3 a:focus-visible,
.paper-panel h3 a:hover,
.paper-panel h3 a:focus-visible {
  color: var(--gold);
  text-decoration: underline;
  outline: none;
}

.paper-panel {
  padding-left: 26px;
  border-left: 2px solid var(--gold);
}

.paper-panel h3 {
  margin-top: 14px;
  font-size: 2rem;
}

.travel-gallery {
  position: relative;
  min-width: 0;
  outline: none;
}

.travel-photo {
  position: relative;
  margin: 0;
  height: min(56vh, 500px);
  overflow: hidden;
  border-radius: 8px;
  background: rgba(6, 32, 39, 0.22);
}

.travel-photo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}

.photo-tag {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 2;
  padding: 7px 12px;
  border-radius: 999px;
  color: #062027;
  background: var(--gold);
}

.gallery-arrow {
  position: absolute;
  top: 50%;
  z-index: 10;
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  border: 1px solid rgba(240, 255, 249, 0.42);
  border-radius: 999px;
  color: var(--foam);
  font-size: 2rem;
  line-height: 1;
  background: rgba(6, 32, 39, 0.6);
  cursor: pointer;
  transform: translateY(-50%);
}

.gallery-arrow.prev {
  left: 14px;
}

.gallery-arrow.next {
  right: 14px;
}

.gallery-arrow:hover,
.gallery-arrow:focus-visible {
  color: #062027;
  background: var(--gold);
}

.contact-lines {
  border-top: 1px solid var(--line);
}

.contact-lines a {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr);
  gap: 24px;
  align-items: center;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
  color: var(--foam);
  text-decoration: none;
}

.contact-lines strong {
  font-size: 1.55rem;
  line-height: 1.15;
}

.contact-lines a:hover strong,
.contact-lines a:focus-visible strong {
  color: var(--gold);
}

@media (max-width: 1180px) {
  h1 span {
    font-size: 4.9rem;
  }

  h1 em {
    font-size: 1.65rem;
  }

  h2 {
    font-size: 3.3rem;
  }

  .hero-grid,
  .about-layout,
  .paper-layout,
  .travel-layout,
  .contact-layout,
  .timeline-layout {
    grid-template-columns: 1fr;
  }

  .hero-grid {
    grid-template-areas:
      "main"
      "photo";
  }

  .hero-photo {
    justify-self: center;
    width: min(340px, 100%);
    max-height: 40vh;
  }
}

@media (max-width: 760px) {
  html {
    scroll-snap-type: y mandatory;
  }

  .site-header {
    inset: 0 auto auto 0;
    display: block;
    width: auto;
    padding: 12px;
    pointer-events: auto;
  }

  .nav-toggle {
    position: relative;
    z-index: 42;
    display: block;
  }

  .site-nav {
    position: fixed;
    inset: 0;
    z-index: 40;
    align-content: center;
    justify-items: start;
    gap: 10px;
    padding: 84px 24px 40px 72px;
    visibility: hidden;
    opacity: 0;
    background: rgba(6, 32, 39, 0.96);
    pointer-events: none;
    transition: opacity 180ms ease, visibility 180ms ease;
  }

  body.nav-open .site-nav {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
  }

  .site-nav a {
    min-width: 190px;
    font-size: 1.02rem;
  }

  .page-section {
    min-height: 100vh;
    min-height: max(100vh, 100dvh);
    height: 100vh;
    height: max(100vh, 100dvh);
    padding: 72px 18px 22px;
  }

  .section-shell {
    display: flex;
    flex-direction: column;
    justify-content: center;
    width: 100%;
    max-width: 394px;
    min-height: calc(100vh - 94px);
    min-height: calc(max(100vh, 100dvh) - 94px);
  }

  .section-head,
  .compact {
    width: 100%;
    margin-right: 0;
    margin-left: 0;
    text-align: left;
  }

  h1 span {
    font-size: 3rem;
  }

  h1 em {
    margin-top: 8px;
    font-size: 1.12rem;
  }

  h2 {
    font-size: 2.18rem;
    line-height: 1.05;
  }

  .eyebrow {
    margin-bottom: 8px;
    font-size: 0.88rem;
  }

  .hero-grid {
    gap: 14px;
  }

  .hero-main {
    display: contents;
  }

  .hero-copy {
    order: 1;
  }

  .hero-photo {
    order: 2;
  }

  .hero-actions {
    order: 3;
  }

  .hero-lead,
  .section-head > p:not(.eyebrow) {
    margin-top: 16px;
    font-size: 0.92rem;
    line-height: 1.4;
  }

  .hero-photo {
    width: 100%;
    max-width: 240px;
    max-height: 30vh;
    max-height: 30dvh;
    margin: 0 auto;
  }

  .hero-actions {
    display: grid;
    gap: 10px;
    width: min(100%, 240px);
    margin: 0 auto;
  }

  .button {
    width: 100%;
    min-height: 42px;
  }

  .about-copy {
    padding-left: 16px;
    font-size: 0.98rem;
    line-height: 1.6;
  }

  .timeline-list article {
    grid-template-columns: 1fr;
    gap: 6px;
    padding: 12px 0;
  }

  .timeline-list,
  .contact-lines {
    width: 100%;
  }

  .timeline-list h3 {
    font-size: 1rem;
  }

  .timeline-list p {
    margin-top: 6px;
    font-size: 0.86rem;
    line-height: 1.35;
  }

  .skill-reef {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 18px;
  }

  .project-grid {
    grid-template-columns: 1fr;
    gap: 10px;
    margin-top: 18px;
  }

  .skill-reef article,
  .project-grid article {
    min-height: 0;
    padding: 12px;
  }

  .skill-reef span,
  .project-grid span,
  .timeline-list time,
  .paper-venue,
  .photo-tag,
  .contact-lines span {
    font-size: 0.74rem;
  }

  .skill-reef h3,
  .project-grid h3 {
    margin-top: 10px;
    font-size: 0.92rem;
  }

  .skill-reef p,
  .project-grid p {
    margin-top: 7px;
    font-size: 0.78rem;
    line-height: 1.28;
  }

  .paper-panel {
    padding-left: 16px;
  }

  .paper-panel h3 {
    margin-top: 10px;
    font-size: 1.26rem;
    line-height: 1.12;
  }

  .paper-panel p {
    margin-bottom: 0;
    font-size: 0.84rem;
    line-height: 1.35;
  }

  .travel-layout {
    gap: 16px;
  }

  .travel-photo {
    height: min(35vh, 300px);
    height: min(35dvh, 300px);
  }

  .gallery-arrow {
    width: 40px;
    height: 40px;
    font-size: 1.6rem;
  }

  .contact-lines a {
    grid-template-columns: 1fr;
    gap: 6px;
    padding: 12px 0;
  }

  .contact-lines strong {
    font-size: 1rem;
    line-height: 1.22;
  }
}
