/* ==========================================================================
   上海菜菜谱大全 · style.css  （首页 + 内页共用版式）
   设计基线：03-ui/home-ui-desktop.png（1024×1536 → 1440×2160）
   分区预算（1440 宽，见 03-ui/compare-log.md）：
     header 68 / hero 361 / M2 331 / M3 145 / M4 195 / M5 210 /
     M6 210 / M7 180 / M8+M9 343 / footer 117  → 合计 2160
   ========================================================================== */

@import url("tokens.css");

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

html{ -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body{
  margin: 0;
  background: var(--bg);
  color: var(--body);
  font: 400 var(--fs-body)/1.72 var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

img{ display: block; max-width: 100%; height: auto; }
a{ color: inherit; text-decoration: none; }
h1,h2,h3{ margin: 0; font-family: var(--font-serif); color: var(--ink); font-weight: 700; letter-spacing: .01em; }
p{ margin: 0; }
ul,ol,dl,dd{ margin: 0; padding: 0; list-style: none; }
button{ font: inherit; color: inherit; }

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

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

.skip-link{
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--red); color: #fff; padding: 10px 18px; border-radius: 0 0 var(--radius) var(--radius);
}
.skip-link:focus{ left: 12px; }

:focus-visible{ outline: 2px solid var(--red); outline-offset: 3px; border-radius: 2px; }

/* ------------------------------------------------------------------ header */
.site-header{
  position: sticky; top: 0; z-index: 60;
  height: var(--header-h);
  background: rgba(246,236,221,.96);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line-soft);
}
.header-inner{ height: 100%; display: flex; align-items: center; gap: 26px; }

.brand{ display: flex; align-items: baseline; gap: 9px; flex: none; }
.brand-name{ font-family: var(--font-serif); font-size: 17px; font-weight: 700; color: var(--ink); letter-spacing: .03em; }
.brand-kicker{ font-size: 9.5px; letter-spacing: .2em; color: var(--red-ink); }

.nav{ display: flex; align-items: center; gap: 18px; margin-left: 14px; }
.nav a{ font-size: 12.5px; color: var(--body); padding: 5px 0; position: relative; white-space: nowrap; }
.nav a::after{
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px;
  background: var(--red); transform: scaleX(0); transform-origin: left; transition: transform .2s ease;
}
.nav a:hover::after,
.nav a[aria-current="page"]::after{ transform: scaleX(1); }
.nav a[aria-current="page"]{ color: var(--red-ink); }

.nav-toggle{
  display: none; width: 36px; height: 32px;
  border: 1px solid var(--line); border-radius: var(--radius); background: none;
  cursor: pointer; padding: 8px 8px; flex-direction: column; justify-content: space-between;
}
.nav-toggle span{ display: block; height: 1.5px; background: var(--ink); }

/* -------------------------------------------------------------------- hero */
.hero{
  position: relative;
  height: 361px;
  background: linear-gradient(96deg, var(--hero-a) 0%, var(--hero-b) 58%, var(--hero-c) 100%);
  overflow: hidden;
}
.hero-inner{
  position: relative; height: 100%;
  width: min(var(--wrap), 100% - var(--gutter) * 2);
  margin-inline: auto;
}
.hero-media{
  position: absolute; top: 0; right: calc(-1 * max(0px, (100vw - var(--wrap)) / 2));
  width: 72%; height: 100%; margin: 0;
  overflow: hidden;
}
.hero-media img{ width: 100%; height: 100%; object-fit: cover; object-position: 55% 50%; }
.hero-media::before{
  content: ""; position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(90deg, rgba(231,203,166,.97) 0%, rgba(231,203,166,.72) 22%, rgba(231,203,166,.22) 42%, rgba(231,203,166,0) 58%);
}
.hero-media figcaption{
  position: absolute; right: 22px; bottom: 14px; z-index: 2;
  font-size: 10.5px; letter-spacing: .04em; color: rgba(255,246,235,.8);
}

.hero-copy{ position: relative; z-index: 2; width: 47%; padding-top: 24px; }
.eyebrow{
  font-size: var(--fs-eyebrow); letter-spacing: .26em; font-weight: 700;
  color: var(--red-ink); text-transform: uppercase;
}
.hero h1{
  margin-top: 12px;
  font-size: 52px; line-height: 1.3; letter-spacing: .01em;
  color: var(--ink-hero);
}
.hero-lead{
  margin-top: 12px; max-width: 34em;
  font-size: 13.5px; line-height: 1.85; color: var(--body);
}
.hero-actions{ display: flex; align-items: center; gap: 12px; margin-top: 16px; }
.btn{
  display: inline-flex; align-items: center; height: 38px; padding: 0 22px;
  border-radius: var(--pill); font-size: 13px; letter-spacing: .02em;
  transition: background .2s ease, color .2s ease, border-color .2s ease;
}
.btn-solid{ background: var(--red); color: #fdf3e6; }
.btn-solid:hover{ background: var(--red-deep); }
.btn-ghost{ border: 1px solid rgba(58,26,18,.5); color: var(--ink); }
.btn-ghost:hover{ border-color: var(--red); color: var(--red); }

.hero-stats{ display: flex; gap: 28px; margin-top: 20px; }
.hero-stats div{ min-width: 0; }
.hero-stats dt{ font-family: var(--font-serif); font-size: 12.5px; font-weight: 700; color: #3a2010; }
.hero-stats dd{ margin: 3px 0 0; font-size: 10.5px; line-height: 1.5; color: #4b3020; }

/* ---------------------------------------------------------------- sections */
.sec-head{ text-align: center; }
.sec-head .eyebrow{ line-height: 1.15; }
.sec-head h2{ margin-top: 7px; font-size: 25px; line-height: 1.14; }
.sec-head.left{ text-align: left; }
.sec-head.left h2{ font-size: 22px; }
.sec-note{ text-align: center; font-size: 11.5px; color: var(--muted-2); letter-spacing: .02em; }
.sec-note.left{ text-align: left; }

/* ------------------------------------------------------------ categories */
.categories{ height: 331px; padding-top: 30px; }
.cat-grid{ display: grid; grid-template-columns: repeat(7, 1fr); gap: 12px; margin-top: 17px; }
.cat{ min-width: 0; }
.cat img{ width: 100%; aspect-ratio: 5 / 3; object-fit: cover; border-radius: var(--radius); background: var(--cream-deep); }
.cat-head{ display: flex; align-items: baseline; gap: 6px; margin-top: 9px; }
.cat-num{ font-family: var(--font-serif); font-size: 10.5px; color: var(--red); letter-spacing: .08em; }
.cat h3{ font-size: 15px; line-height: 1.3; }
.cat p{ margin-top: 5px; font-size: 11.5px; line-height: 1.62; color: var(--body-strong); }
.categories .sec-note{ margin-top: 12px; }

/* ---------------------------------------------------------------- flavors */
.flavors{ height: 145px; padding-top: 22px; }
.flavor-grid{ display: grid; grid-template-columns: repeat(8, 1fr); margin-top: 14px; }
.flavor-grid li{ padding: 8px 11px 0; border-top: 1px solid var(--line); }
.flavor-grid li + li{ border-left: 1px solid var(--line-soft); }
.flavor-grid li:first-child{ padding-left: 0; }
.flavor-grid h3{ font-size: 14.5px; color: var(--red-ink); }
.flavor-grid p{ margin-top: 4px; font-size: 11px; line-height: 1.62; color: var(--body-strong); }
.flavors .sec-note{ margin-top: 10px; }

/* --------------------------------------------------------------- featured */
.featured{ height: 195px; padding-top: 10px; }
.dish-grid{ display: grid; grid-template-columns: repeat(6, 1fr); gap: 13px; margin-top: 16px; }
.dish{ display: block; }
.dish img{
  width: 100%; aspect-ratio: 20 / 9; object-fit: cover;
  border-radius: var(--radius); background: var(--cream-deep);
  transition: filter .2s ease;
}
.dish:hover img{ filter: brightness(1.06) saturate(1.06); }
.dish h3{ margin-top: 8px; font-size: 14.5px; }
.dish p{ margin-top: 4px; font-size: 11px; line-height: 1.58; color: var(--body-strong); }

/* ------------------------------------------------------------------- path */
.path{ height: 210px; padding-top: 28px; background: var(--cream); }
.path-list{ display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 16px; }
.path-list li{ padding: 0 26px; border-left: 1px solid var(--line); }
.path-list li:first-child{ padding-left: 0; border-left: 0; }
.path-step{ font-family: var(--font-serif); font-size: 10.5px; letter-spacing: .16em; color: var(--red); }
.path-list h3{ margin-top: 4px; font-size: 16px; }
.path-list p{ margin-top: 5px; font-size: 11.5px; line-height: 1.7; color: var(--muted); }
.path-warn{
  margin-top: 14px; padding-left: 12px; border-left: 2px solid var(--red);
  font-size: 11.5px; line-height: 1.7; color: var(--red-ink);
}

/* ----------------------------------------------------------------- pantry */
.pantry{ height: 210px; padding-top: 30px; }
.shelf-grid{ display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px 26px; margin-top: 12px; }
.shelf-grid li{ min-width: 0; display: grid; grid-template-columns: 58px 1fr; gap: 12px; align-items: start; }
.shelf-grid img{ width: 58px; height: 82px; object-fit: cover; border-radius: var(--radius); background: var(--cream-deep); }
.shelf-grid h3{ font-size: 13.5px; }
.shelf-grid p{ margin-top: 3px; font-size: 11px; line-height: 1.6; color: var(--body-strong); }
.pantry .sec-note{ margin-top: 9px; }

/* -------------------------------------------------------------- technique */
.technique{ height: 180px; padding-top: 25px; background: var(--cream); }
.tech-grid{ display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px 26px; margin-top: 12px; }
.tech-grid li{ min-width: 0; display: grid; grid-template-columns: 62px 1fr; gap: 12px; align-items: start; }
.tech-grid img{ width: 62px; height: 82px; object-fit: cover; border-radius: var(--radius); background: var(--cream-deep); }
.tech-grid h3{ font-size: 13.5px; }
.tech-grid p{ margin-top: 3px; font-size: 11px; line-height: 1.6; color: var(--body-strong); }

/* ------------------------------------------------------------ faq + scope */
.faq-scope{ position: relative; height: 343px; padding-top: 14px; overflow: hidden; }
.faq-scope-grid{ display: grid; grid-template-columns: 1.05fr .95fr; gap: 60px; }
.faq-scope-media{
  position: absolute; top: 26px; right: calc(-1 * max(0px, (100vw - var(--wrap)) / 2));
  width: 172px; height: 250px; margin: 0; overflow: hidden;
}
.faq-scope-media img{ width: 100%; height: 100%; object-fit: cover; }
.faq-scope-media::before{
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(246,236,221,.95) 0%, rgba(246,236,221,.25) 45%, rgba(246,236,221,0) 100%);
}

.faq-list{ margin-top: 12px; border-top: 1px solid var(--line); }
.faq-list details{ border-bottom: 1px solid var(--line); }
.faq-list summary{
  position: relative; padding: 10px 26px 10px 0; cursor: pointer;
  font-family: var(--font-serif); font-size: 12.5px; font-weight: 700; color: var(--ink);
  list-style: none;
}
.faq-list summary::-webkit-details-marker{ display: none; }
.faq-list summary::after{
  content: "+"; position: absolute; right: 2px; top: 50%; transform: translateY(-50%);
  color: var(--red); font-size: 14px; font-family:'PingFang SC','Microsoft YaHei','Noto Sans SC',-apple-system,BlinkMacSystemFont,'Segoe UI',Arial,sans-serif;
}
.faq-list details[open] summary::after{ content: "−"; }
.faq-list p{ padding: 0 26px 11px 0; font-size: 11.5px; line-height: 1.72; color: var(--body-strong); }

.scope{ padding-right: 176px; }
.scope-list{ margin-top: 12px; }
.scope-list li{ padding: 9px 0; border-top: 1px solid var(--line); }
.scope-list h3{ font-size: 12.5px; color: var(--red-ink); }
.scope-list p{ margin-top: 3px; font-size: 11.5px; line-height: 1.7; color: var(--body-strong); }

/* ----------------------------------------------------------------- footer */
.site-footer{ min-height: 117px; background: var(--red); color: #f2ddcb; }
.footer-inner{
  min-height: 117px; display: flex; flex-wrap: wrap;
  align-items: center; justify-content: space-between; gap: 16px 34px;
}
.footer-brand{ flex: 1 1 200px; min-width: 170px; }
.footer-nav,.footer-hot{ flex: 1 1 180px; min-width: 160px; display: flex; flex-wrap: wrap; gap: 6px 16px; align-content: center; }
.footer-meta{ flex: 1 1 180px; min-width: 160px; }
.footer-logo{ font-family: var(--font-serif); font-size: 17px; font-weight: 700; color: #fdf3e6; }
.footer-line{ margin-top: 5px; font-size: 10.5px; color: rgba(253,243,230,.74); }
.footer-nav a,.footer-hot a{ font-size: 11.5px; color: rgba(253,243,230,.9); }
.footer-nav a:hover,.footer-hot a:hover{ color: #fff; text-decoration: underline; text-underline-offset: 3px; }
.footer-meta{ font-size: 10px; line-height: 1.7; color: rgba(253,243,230,.6); }

.search-empty{ display: none; margin-top: 18px; font-size: 12px; color: var(--muted); }
.search-empty.is-on{ display: block; }
.is-hidden{ display: none !important; }

/* ------------------------------------------------------------------ 响应式 */
@media (max-width: 1180px){
  :root{ --fs-h1: 40px; }
  .hero{ height: auto; }
  .hero-copy{ width: 58%; padding-bottom: 34px; }
  .hero h1{ font-size: 40px; }
  .nav{ gap: 12px; }
  .nav a{ font-size: 11.5px; }
  .categories,.flavors,.featured,.path,.pantry,.technique,.faq-scope{ height: auto; padding-bottom: 24px; }
  .faq-scope-media{ display: none; }
  .scope{ padding-right: 0; }
}

@media (max-width: 1024px){
  .cat-grid{ grid-template-columns: repeat(4, 1fr); row-gap: 16px; }
  .flavor-grid{ grid-template-columns: repeat(4, 1fr); row-gap: 14px; }
  .flavor-grid li:nth-child(4n+1){ border-left: 0; padding-left: 0; }
  .dish-grid{ grid-template-columns: repeat(3, 1fr); row-gap: 16px; }
  .faq-scope-grid{ grid-template-columns: 1fr; gap: 28px; }
  .hero-media{ display: none; }
  .hero-copy{ width: 100%; padding: 40px 0 34px; }
  .footer-inner{ height: auto; min-height: 0; padding: 26px 0; flex-direction: column; align-items: flex-start; gap: 14px; }
  .footer-brand,.footer-nav,.footer-hot,.footer-meta{ flex: 0 0 auto; }
}

@media (max-width: 900px){
  /* 768 及以下折成抽屉式导航：8 个导航项 + 搜索胶囊在 768 会横向溢出 */
  .nav{
    position: absolute; left: 0; right: 0; top: var(--header-h);
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--bg); border-bottom: 1px solid var(--line);
    padding: 6px 20px 14px; display: none; margin-left: 0;
  }
  .nav.is-open{ display: flex; }
  .nav a{ padding: 10px 0; border-bottom: 1px solid var(--line-soft); font-size: 13px; }
  .nav-toggle{ display: flex; }
}

@media (max-width: 720px){
  :root{ --gutter: 20px; --header-h: 52px; }
  .nav-toggle{ margin-left: auto; flex: none; }
  .brand-name{ font-size: 15px; }
  .brand-kicker{ display: none; }
  .hero h1{ font-size: 30px; line-height: 1.26; }
  .hero-lead{ font-size: 13px; }
  .hero-stats{ flex-wrap: wrap; gap: 12px 20px; }
  .cat-grid{ grid-template-columns: repeat(2, 1fr); }
  .flavor-grid{ grid-template-columns: repeat(2, 1fr); }
  .flavor-grid li{ border-left: 0 !important; padding-left: 0; }
  .dish-grid{ grid-template-columns: repeat(2, 1fr); }
  .path-list{ grid-template-columns: 1fr; }
  .path-list li{ padding: 14px 0; border-left: 0; border-top: 1px solid var(--line); }
  .path-list li:first-child{ border-top: 0; padding-top: 0; }
  .shelf-grid,.tech-grid{ grid-template-columns: repeat(2, 1fr); }
  .sec-head h2{ font-size: 20px; }
  .sec-head.left h2{ font-size: 18px; }
  .sec-note{ font-size: 11px; }
}

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