/* ==========================================================
Sakura Nihongo Lab · Original learning-site design
Theme: paper white / ink navy / cherry coral / jade accents
Organized components: base → header → home → article → responsive
========================================================== */
:root {
  --paper: #f6f4ef;
  --cream: #fffcf6;
  --ink: #263341;
  --muted: #65717c;
  --line: #e4e4df;
  --coral: #dd756d;
  --dark: #24394c;
  --green: #607f76;
  --radius: 18px;
  --shadow: 0 18px 55px rgba(34, 47, 58, .08);
}
* {
  box-sizing: border-box;
}
html {
  scroll-behavior: smooth;
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.8 -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  overflow-wrap: anywhere;
}
img {
  display: block;
  max-width: 100%;
  height: auto;
}
a {
  color: inherit;
  text-decoration: none;
}
a:focus-visible, summary:focus-visible {
  outline: 3px solid var(--coral);
  outline-offset: 4px;
}
.shell {
  width: min(1180px, calc(100% - 44px));
  margin-inline: auto;
}
.skip-link {
  position: absolute;
  left: 12px;
  top: -100px;
  z-index: 100;
  background: white;
  padding: 9px 14px;
}
.skip-link:focus {
  top: 12px;
}
.site-header {
  background: var(--cream);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: max-content;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 43px;
  height: 43px;
  border-radius: 13px;
  background: var(--coral);
  color: white;
  font: 28px/1 Georgia, serif;
}
.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.28;
}
.brand-text strong {
  font-size: 19px;
  letter-spacing: .08em;
}
.brand-text small {
  color: #87919a;
  font-size: 9px;
  letter-spacing: .14em;
  margin-top: 5px;
}
.main-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 25px;
  align-items: center;
}
.main-nav a {
  font-weight: 650;
  font-size: 14px;
  padding: 9px 0;
}
.main-nav a:hover {
  color: var(--coral);
}
.hero {
  display: grid;
  grid-template-columns: 1.02fr 1fr;
  gap: 4vw;
  align-items: center;
  padding-block: 72px 82px;
}
.eyebrow, .kicker {
  color: var(--coral);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .14em;
}
.eyebrow {
  display: flex;
  align-items: center;
  gap: 12px;
}
.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--coral);
}
.hero h1 {
  margin: 26px 0 22px;
  font-size: clamp(42px, 5.8vw, 76px);
  line-height: 1.23;
  letter-spacing: -.045em;
}
.hero h1 span {
  display: block;
  color: var(--coral);
  font-size: clamp(24px, 3vw, 42px);
  letter-spacing: -.025em;
  margin-top: 13px;
}
.hero-desc {
  color: var(--muted);
  font-size: 15px;
  max-width: 590px;
}
.hero-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
  margin-top: 30px;
}
.btn-primary, .btn-light {
  display: inline-flex;
  gap: 26px;
  align-items: center;
  background: var(--dark);
  color: white;
  border-radius: 9px;
  padding: 11px 22px;
  font-weight: 700;
  font-size: 14px;
}
.text-link {
  font-size: 14px;
  font-weight: 700;
  border-bottom: 1px solid currentColor;
}
.hero-note {
  margin-top: 39px;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: .07em;
}
.hero-art {
  position: relative;
  min-width: 0;
}
.hero-img {
  aspect-ratio: 4 / 4.15;
  object-fit: cover;
  width: 100%;
  border-radius: 180px 180px 18px 18px;
  box-shadow: var(--shadow);
}
.hero-stamp {
  position: absolute;
  right: -22px;
  bottom: 35px;
  background: #f1dbcc;
  width: 165px;
  height: 165px;
  border: 9px solid var(--paper);
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  text-align: center;
  transform: rotate(-9deg);
}
.hero-stamp strong {
  font-size: 24px;
}
.hero-stamp small {
  font-size: 10px;
  letter-spacing: .08em;
}
.strip {
  background: var(--dark);
  color: #e3e8e8;
}
.strip-items {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  text-align: center;
}
.strip-items span {
  padding: 18px 8px;
  font-size: 13px;
  font-weight: 700;
  border-right: 1px solid #ffffff25;
}
.strip-items span:last-child {
  border-right: 0;
}
.section-pad {
  padding-block: 94px;
}
.small-pad {
  padding-block: 66px;
}
.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 30px;
  margin-bottom: 36px;
}
.section-heading .kicker {
  margin: 0 0 10px;
}
.section-heading h2 {
  margin: 0;
  font-size: clamp(27px, 3vw, 39px);
  line-height: 1.35;
  letter-spacing: -.025em;
}
.section-heading > p {
  max-width: 350px;
  color: var(--muted);
  font-size: 14px;
  margin: 0;
}
.category-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 260px 260px;
  gap: 18px;
}
.category-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 28px 30px;
  border-radius: var(--radius);
  background: #e7ece9;
}
.category-tile:nth-child(2) {
  background: #ece2df;
}
.category-tile:nth-child(3) {
  background: #ece8db;
}
.category-tile:nth-child(4) {
  background: #e2e7ed;
}
.tile-no {
  z-index: 2;
  font-size: 11px;
  letter-spacing: .15em;
  font-weight: 800;
}
.tile-main {
  position: relative;
  z-index: 2;
  width: 62%;
  margin-top: auto;
}
.tile-main h3 {
  margin: 0 0 7px;
  font-size: 27px;
}
.tile-main p {
  margin: 0 0 11px;
  font-size: 13px;
  line-height: 1.7;
}
.tile-main span {
  color: #b75c59;
  font-weight: 800;
  font-size: 13px;
}
.category-tile img {
  position: absolute;
  right: 0;
  top: 0;
  height: 100%;
  width: 39%;
  object-fit: cover;
  mask-image: linear-gradient(to right, transparent, black 30%);
}
.category-tile:hover {
  transform: translateY(-3px);
  transition: transform .2s;
}
.spotlight-band {
  background: #e7e6df;
  padding-block: 72px;
}
.spotlight-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6vw;
  align-items: center;
}
.spotlight-photo img {
  width: 100%;
  aspect-ratio: 1.16;
  object-fit: cover;
  border-radius: 16px 140px 16px 16px;
}
.spotlight-content h2 {
  font-size: clamp(27px, 3.2vw, 44px);
  line-height: 1.35;
  margin: 20px 0;
}
.spotlight-content > p:not(.kicker) {
  color: var(--muted);
}
.sample-row {
  background: #fffaf3;
  border-left: 3px solid var(--coral);
  display: flex;
  flex-direction: column;
  padding: 16px 18px;
  margin-block: 22px;
  gap: 3px;
}
.sample-row span {
  font-size: 20px;
  font-weight: 750;
}
.sample-row small {
  color: var(--muted);
}
.btn-light {
  background: var(--coral);
}
.lesson-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}
.lesson-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--cream);
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 27px 24px 22px;
  min-height: 234px;
  transition: transform .2s, box-shadow .2s;
}
.lesson-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
}
.card-tag {
  color: var(--coral);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .13em;
}
.lesson-card h3 {
  font-size: 20px;
  line-height: 1.45;
  margin: 16px 0 10px;
}
.lesson-card p {
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 20px;
}
.card-arrow {
  margin-top: auto;
  font-size: 12px;
  font-weight: 750;
  color: var(--green);
}
.study-banner {
  background: #e7dcd9;
  border-radius: 19px;
  display: grid;
  grid-template-columns: 1.2fr .8fr;
  gap: 35px;
  overflow: hidden;
  margin-bottom: 95px;
}
.study-banner > div {
  padding: 52px;
}
.study-banner h2 {
  font-size: 32px;
  line-height: 1.4;
  margin: 14px 0;
}
.study-banner p:not(.kicker) {
  color: #5e656a;
}
.study-banner a {
  text-decoration: underline;
  font-weight: 800;
}
.study-banner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  max-height: 400px;
}
.site-footer {
  background: var(--dark);
  color: #f4f5f1;
  padding-top: 62px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1.5fr;
  gap: 55px;
}
.footer-grid > div {
  display: flex;
  flex-direction: column;
  align-items: start;
  gap: 9px;
}
.footer-brand {
  font-weight: 800;
  font-size: 22px;
}
.footer-grid p, .footer-grid span, .footer-grid a {
  color: #c5d1d7;
  font-size: 13px;
  margin: 0;
}
.footer-grid strong {
  margin-bottom: 8px;
}
.footer-grid a:hover {
  color: white;
  text-decoration: underline;
}
.footer-bottom {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-top: 55px;
  padding-block: 22px;
  border-top: 1px solid #ffffff24;
  color: #b2c0c9;
  font-size: 12px;
}
.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--muted);
  margin: 28px 0;
}
.breadcrumbs a:hover {
  color: var(--coral);
}
.category-hero {
  display: grid;
  grid-template-columns: 1fr .62fr;
  gap: 36px;
  background: #e9e8e2;
  padding: 46px;
  align-items: center;
  border-radius: 17px;
}
.category-hero h1, .about-hero h1 {
  font-size: clamp(32px, 4vw, 51px);
  line-height: 1.3;
  margin: 14px 0;
}
.category-hero p:not(.kicker) {
  color: var(--muted);
  max-width: 600px;
}
.category-hero img {
  border-radius: 13px 90px 13px 13px;
  width: 100%;
  height: 240px;
  object-fit: cover;
}
.category-count {
  display: inline-block;
  color: var(--coral);
  font-weight: 750;
  margin-top: 15px;
  font-size: 13px;
}
.back-line {
  padding: 24px 0 80px;
  font-size: 14px;
  font-weight: 750;
  color: var(--green);
}
.article-shell {
  max-width: 1140px;
}
.article-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 250px;
  gap: 54px;
  align-items: start;
}
.article-head {
  padding: 25px 0 31px;
}
.article-head h1 {
  font-size: clamp(30px, 4.5vw, 50px);
  line-height: 1.32;
  margin: 17px 0;
}
.article-lead {
  font-size: 18px;
  color: #526270;
}
.article-meta {
  color: #88949a;
  font-size: 12px;
}
.article-cover img {
  border-radius: 17px;
  width: 100%;
  height: min(43vw, 380px);
  object-fit: cover;
}
.article-section {
  padding-top: 34px;
}
.article-section h2, .prose h2 {
  font-size: 25px;
  line-height: 1.4;
  margin: 10px 0 20px;
}
.article-section > p, .prose p {
  color: #48545c;
  margin: 12px 0;
}
.examples {
  display: grid;
  gap: 14px;
}
.example-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
  padding: 18px 22px;
}
.example-item .jp {
  font-weight: 800;
  font-size: 19px;
}
.example-item .zh {
  color: var(--coral);
  margin-top: 5px;
  font-weight: 750;
}
.example-item p {
  color: var(--muted);
  margin: 5px 0 0;
  font-size: 14px;
}
.note-box {
  background: #f6e8e3;
  border-left: 4px solid var(--coral);
  padding: 20px 24px;
  border-radius: 0 10px 10px 0;
}
.note-box p {
  margin-bottom: 0;
}
.exercise {
  background: #e6ebe7;
  border-radius: 13px;
  padding: 25px;
}
.exercise > span {
  color: var(--green);
  font-size: 12px;
  letter-spacing: .1em;
  font-weight: 800;
}
.exercise > p {
  font-size: 18px;
  font-weight: 750;
}
.exercise details {
  background: white;
  padding: 12px 15px;
  border-radius: 8px;
}
.exercise summary {
  cursor: pointer;
  font-weight: 700;
}
.exercise details p {
  margin-bottom: 0;
}
.article-sidebar {
  position: sticky;
  top: 25px;
  padding-top: 40px;
}
.toc-box, .aside-tip {
  background: white;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 23px;
  margin-bottom: 18px;
}
.toc-box {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.toc-box strong, .aside-tip strong {
  margin-bottom: 7px;
}
.toc-box a {
  color: var(--muted);
  font-size: 13px;
}
.toc-box a:hover {
  color: var(--coral);
}
.aside-tip {
  background: #e9eee9;
}
.aside-tip p {
  font-size: 13px;
  color: var(--muted);
}
.related-section {
  padding-top: 65px;
}
.about-hero {
  background: #e7e9e2;
  border-radius: 15px;
  padding: 60px;
}
.about-hero p:last-child {
  max-width: 750px;
  color: #58646e;
}
.prose {
  max-width: 800px;
  padding: 35px 0 90px;
}
@media (max-width: 1050px) {
  .main-nav {
    gap: 8px 14px;
  }
  .lesson-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .article-layout {
    gap: 26px;
    grid-template-columns: minmax(0, 1fr) 220px;
  }
}
@media (max-width: 760px) {
  .shell {
    width: min(100% - 30px, 620px);
  }
  .header-inner {
    padding-block: 15px;
    align-items: start;
    flex-direction: column;
    gap: 13px;
  }
  .main-nav {
    width: 100%;
    gap: 6px 16px;
  }
  .main-nav a {
    font-size: 13px;
    padding: 5px 0;
  }
  .hero {
    grid-template-columns: 1fr;
    padding-block: 43px 60px;
    gap: 32px;
  }
  .hero h1 {
    margin-top: 19px;
  }
  .hero-art {
    width: min(92%, 490px);
    margin: auto;
  }
  .hero-img {
    max-height: 460px;
  }
  .hero-stamp {
    right: -9px;
    width: 128px;
    height: 128px;
    border-width: 5px;
    font-size: 11px;
  }
  .hero-stamp strong {
    font-size: 20px;
  }
  .strip-items {
    grid-template-columns: 1fr 1fr;
  }
  .strip-items span:nth-child(2) {
    border-right: 0;
  }
  .section-pad {
    padding-block: 60px;
  }
  .section-heading {
    flex-direction: column;
    align-items: start;
    gap: 13px;
  }
  .category-layout {
    grid-template-columns: 1fr;
    grid-template-rows: none;
  }
  .category-tile {
    min-height: 230px;
  }
  .spotlight-band {
    padding-block: 50px;
  }
  .spotlight-grid, .study-banner, .category-hero {
    grid-template-columns: 1fr;
  }
  .study-banner > div {
    padding: 30px;
  }
  .study-banner {
    margin-bottom: 60px;
  }
  .study-banner img {
    max-height: 275px;
  }
  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 30px;
  }
  .footer-grid > div:first-child {
    grid-column: 1 / -1;
  }
  .footer-bottom {
    flex-direction: column;
    gap: 7px;
  }
  .category-hero {
    padding: 27px;
    gap: 16px;
  }
  .category-hero img {
    max-height: 220px;
  }
  .article-layout {
    grid-template-columns: 1fr;
  }
  .article-sidebar {
    position: static;
    padding-top: 8px;
  }
  .toc-box {
    display: none;
  }
  .article-cover img {
    height: auto;
    aspect-ratio: 1.45;
  }
  .about-hero {
    padding: 34px;
  }
}
@media (max-width: 480px) {
  .hero h1 {
    font-size: 40px;
  }
  .hero h1 span {
    font-size: 26px;
  }
  .lesson-grid {
    grid-template-columns: 1fr;
  }
  .lesson-card {
    min-height: auto;
  }
  .tile-main {
    width: 69%;
  }
  .category-tile img {
    width: 36%;
  }
  .study-banner h2 {
    font-size: 27px;
  }
  .footer-grid {
    grid-template-columns: 1fr;
  }
  .footer-grid > div:first-child {
    grid-column: auto;
  }
  .article-head h1 {
    font-size: 31px;
  }
}
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .lesson-card, .category-tile {
    transition: none;
  }
}

/* ===== Search readability & layout safeguards ===== */
html { -webkit-text-size-adjust: 100%; }
body { min-width: 320px; }
main, section, article, aside, .shell, .hero-copy, .spotlight-content { min-width: 0; }
:where(.jp, .zh, .article-lead, .example-item) { overflow-wrap: anywhere; }
:where(.site-header, .main-nav) a { text-underline-offset: 4px; }
:where(.site-header, .main-nav) a:focus-visible { border-radius: 3px; }
.hero-img { object-position: center; }
@media (max-width: 760px) {
  .header-inner { align-items: stretch; }
  .main-nav { display: flex; flex-wrap: wrap; gap: 4px 14px; }
  .main-nav a { padding: 7px 0; }
  .hero-stamp { right: 0; }
  .section-heading h2 { overflow-wrap: anywhere; }
  .category-tile { min-width: 0; }
  .tile-main { max-width: 100%; }
}
@media (max-width: 380px) {
  .shell { width: calc(100% - 24px); }
  .hero h1 { font-size: 34px; }
  .hero h1 span { font-size: 23px; }
  .category-tile { padding: 20px; }
  .tile-main { width: 73%; }
  .hero-stamp { width: 108px; height: 108px; }
}
