:root {
  --ink: #173c30;
  --muted: #57675f;
  --green: #2f684f;
  --green-dark: #204c3b;
  --cream: #fffaf0;
  --line: rgba(31, 76, 59, 0.15);
  --shadow: 0 20px 60px rgba(27, 63, 49, 0.12);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: #fffdf8;
  font-family: "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.7;
}
a { color: inherit; }
img { display: block; max-width: 100%; }
.skip-link {
  position: fixed;
  left: 1rem;
  top: -5rem;
  z-index: 100;
  padding: .7rem 1rem;
  background: #fff;
  border: 2px solid var(--green);
  border-radius: .6rem;
}
.skip-link:focus { top: 1rem; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 82px;
  padding: .75rem clamp(1.1rem, 4vw, 4rem);
  background: rgba(255, 253, 248, .94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}
.brand {
  display: flex;
  gap: .8rem;
  align-items: center;
  text-decoration: none;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  color: white;
  background: var(--green);
  border-radius: 50% 50% 50% 12%;
  font-size: 1.45rem;
  font-weight: 800;
}
.brand strong { display: block; font-size: 1.45rem; letter-spacing: .08em; }
.brand small { display: block; color: var(--muted); font-size: .78rem; letter-spacing: .06em; }
.main-nav { display: flex; align-items: center; gap: .4rem; }
.main-nav a {
  padding: .55rem 1rem;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 700;
}
.main-nav a:hover, .main-nav a:focus-visible { background: #e7f0dc; }
.nav-button {
  padding: .55rem 1rem;
  color: white;
  background: var(--green);
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}
.menu-button {
  display: none;
  padding: .55rem .85rem;
  color: var(--ink);
  background: white;
  border: 1px solid var(--line);
  border-radius: .7rem;
  font: inherit;
  font-weight: 700;
}

.hero {
  display: grid;
  grid-template-columns: minmax(340px, .78fr) minmax(0, 1.32fr);
  min-height: 580px;
  overflow: hidden;
  background: var(--cream);
  border-bottom: 1px solid var(--line);
}
.hero-copy {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  padding: clamp(3rem, 7vw, 7rem) clamp(1.4rem, 5vw, 5rem);
}
.eyebrow {
  margin: 0 0 .5rem;
  color: var(--green);
  font-weight: 800;
  letter-spacing: .12em;
}
.hero h1 {
  margin: 0;
  font-family: "Noto Serif TC", "PMingLiU", serif;
  font-size: clamp(3rem, 6vw, 6.5rem);
  line-height: 1.08;
  letter-spacing: .04em;
}
.hero h1 span { color: #a64b24; }
.hero-copy > p:not(.eyebrow) { max-width: 34rem; margin: 1.4rem 0 1.8rem; color: #394a43; font-size: 1.1rem; }
.primary-button {
  display: inline-flex;
  align-items: center;
  min-height: 54px;
  padding: .7rem 1.8rem;
  color: white;
  background: var(--green);
  border-radius: 999px;
  box-shadow: 0 12px 24px rgba(47, 104, 79, .22);
  text-decoration: none;
  font-weight: 800;
}
.primary-button:hover, .primary-button:focus-visible { background: var(--green-dark); transform: translateY(-2px); }
.hero-image-wrap { position: relative; min-height: 100%; overflow: hidden; background: #dce8cb; }
.hero-image-wrap::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, var(--cream) 0%, transparent 18%);
  pointer-events: none;
}
.hero-image-wrap img {
  width: 100%;
  height: 125%;
  object-fit: cover;
  object-position: 76% 44%;
  transform: translateY(-9%);
}

.learning-section { padding: clamp(4rem, 8vw, 7rem) clamp(1.1rem, 5vw, 5rem); }
.section-heading { max-width: 760px; margin-bottom: 2.2rem; }
.section-heading h2, .guide-section h2 { margin: 0; font-family: "Noto Serif TC", "PMingLiU", serif; font-size: clamp(2.2rem, 4vw, 3.6rem); line-height: 1.2; }
.section-heading > p:last-child { color: var(--muted); }
.resource-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.2rem; }
.resource-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 410px;
  padding: clamp(1.5rem, 3vw, 2.3rem);
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, .07);
  border-radius: 26px;
  box-shadow: var(--shadow);
  transition: transform .2s ease, box-shadow .2s ease;
}
.resource-card:hover { transform: translateY(-6px); box-shadow: 0 26px 70px rgba(27, 63, 49, .18); }
.card-english { background: linear-gradient(145deg, #ecf4e5, #dcebcf); }
.card-earth { background: linear-gradient(145deg, #e6f1f2, #cce4e4); }
.card-bookkeeping { background: linear-gradient(145deg, #fff1dc, #f4dab0); }
.card-number {
  margin: 0 0 2.2rem;
  color: rgba(23, 60, 48, .28);
  font-family: Georgia, serif;
  font-size: 3.6rem;
  line-height: 1;
}
.subject-tag { display: inline-block; padding: .2rem .7rem; background: rgba(255,255,255,.65); border-radius: 999px; font-size: .82rem; font-weight: 800; }
.resource-card h3 { margin: .75rem 0 .6rem; font-size: clamp(1.5rem, 2.4vw, 2rem); line-height: 1.25; }
.resource-card div p { margin: 0; color: #46574f; }
.resource-card > a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 54px;
  margin-top: auto;
  padding: .7rem 1rem;
  color: white;
  background: var(--ink);
  border-radius: 14px;
  text-decoration: none;
  font-weight: 800;
}
.resource-card > a span { font-size: 1.5rem; }
.resource-card > a:hover, .resource-card > a:focus-visible { background: #a64b24; }

.guide-section {
  display: grid;
  grid-template-columns: .7fr 1.3fr;
  gap: 3rem;
  align-items: center;
  margin: 0 clamp(1.1rem, 5vw, 5rem) clamp(4rem, 8vw, 7rem);
  padding: clamp(2rem, 5vw, 4rem);
  color: white;
  background: var(--ink);
  border-radius: 30px;
}
.records-section { padding: 0 clamp(1.1rem, 5vw, 5rem) clamp(4rem, 8vw, 7rem); }
.records-list { display: grid; gap: .75rem; max-width: 900px; }
.record-item {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.2rem;
  background: white;
  border: 1px solid var(--line);
  border-radius: 14px;
}
.record-item span { color: var(--muted); }
.empty-state { padding: 1.5rem; color: var(--muted); background: #f4f5ec; border-radius: 14px; }

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(17, 45, 35, .88);
  backdrop-filter: blur(10px);
}
.login-screen[hidden] { display: none; }
.login-card {
  width: min(100%, 430px);
  padding: clamp(1.6rem, 5vw, 2.6rem);
  background: #fffdf8;
  border-radius: 26px;
  box-shadow: 0 28px 80px rgba(0, 0, 0, .28);
}
.login-card .brand-mark { margin-bottom: 1rem; }
.login-card h2 { margin: 0 0 1.2rem; font-size: 2rem; }
.login-card label { display: grid; gap: .35rem; margin-bottom: 1rem; font-weight: 800; }
.login-card input, .admin-form input, .admin-form select {
  width: 100%;
  min-height: 50px;
  padding: .7rem .85rem;
  border: 1px solid rgba(23, 60, 48, .28);
  border-radius: 10px;
  background: white;
  font: inherit;
}
.login-card .primary-button { width: 100%; justify-content: center; border: 0; cursor: pointer; }
.form-error { min-height: 1.7rem; margin: .2rem 0 .7rem; color: #a42c20; font-weight: 700; }
.guide-section .eyebrow { color: #cce09a; }
.guide-section ol { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin: 0; padding: 0; list-style: none; counter-reset: steps; }
.guide-section li { counter-increment: steps; display: flex; flex-direction: column; padding: 1.2rem; border-left: 1px solid rgba(255,255,255,.25); }
.guide-section li::before { content: "0" counter(steps); color: #cce09a; font-size: .85rem; font-weight: 800; }
.guide-section strong { margin: .5rem 0 .2rem; font-size: 1.12rem; }
.guide-section span { color: rgba(255,255,255,.72); font-size: .92rem; }

footer { display: flex; justify-content: space-between; gap: 1rem; padding: 2rem clamp(1.1rem, 5vw, 5rem); color: var(--muted); background: #f4f5ec; border-top: 1px solid var(--line); font-size: .9rem; }
footer p { margin: 0; }

:focus-visible { outline: 3px solid #e59b32; outline-offset: 4px; }

@media (max-width: 980px) {
  .hero { grid-template-columns: 1fr; }
  .hero-copy { min-height: 450px; }
  .hero-image-wrap { height: min(66vw, 560px); }
  .hero-image-wrap::after { background: linear-gradient(180deg, var(--cream) 0%, transparent 18%); }
  .resource-grid { grid-template-columns: 1fr; }
  .resource-card { min-height: 320px; }
  .guide-section { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
  body { font-size: 16px; }
  .site-header { min-height: 70px; }
  .brand strong { font-size: 1.2rem; }
  .brand small { display: none; }
  .brand-mark { width: 42px; height: 42px; }
  .menu-button { display: block; }
  .main-nav {
    position: absolute;
    top: calc(100% + 1px);
    left: 0;
    right: 0;
    display: none;
    flex-direction: column;
    align-items: stretch;
    padding: .8rem 1rem 1rem;
    background: #fffdf8;
    border-bottom: 1px solid var(--line);
    box-shadow: 0 14px 30px rgba(0,0,0,.08);
  }
  .main-nav.open { display: flex; }
  .main-nav a { padding: .8rem 1rem; }
  .hero { min-height: 0; }
  .hero-copy { min-height: 400px; padding-top: 4rem; padding-bottom: 3rem; }
  .hero h1 { font-size: clamp(2.8rem, 15vw, 4.2rem); }
  .hero-image-wrap { height: 62vw; min-height: 260px; }
  .learning-section { padding-top: 4rem; }
  .resource-card { min-height: 350px; }
  .guide-section { border-radius: 20px; }
  .guide-section ol { grid-template-columns: 1fr; }
  .guide-section li { border-left: 0; border-top: 1px solid rgba(255,255,255,.25); }
  footer { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
}
