/* TailTrack website. Colours come from the app (lib/theme/app_theme.dart). */
@font-face {
  font-family: "Atkinson Next";
  src: url("/fonts/atkinson-hyperlegible-next-latin-wght-normal.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}

:root {
  --paper: #F7F8F2;
  --white: #FFFFFF;
  --ink: #203B35;
  --muted: #56665F;
  --teal: #176B5B;
  --deep: #104D43;
  --mint: #E5F0E7;
  --line: #DCE5DA;
  --tan: #E7B985;
  --tan-ink: #8A5A2B;
  --sans: "Atkinson Next", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --cjk: "Atkinson Next", "PingFang TC", "Noto Sans TC", "Noto Sans CJK TC", "Microsoft JhengHei", system-ui, sans-serif;
  --measure: 66ch;
  --wrap: 1120px;
  --step--1: 0.875rem;
  --step-0: 1.0625rem;
  --step-1: 1.25rem;
  --step-2: 1.625rem;
  --step-3: clamp(1.875rem, 1.3rem + 2.2vw, 2.625rem);
  --step-4: clamp(2.25rem, 1.4rem + 3.6vw, 3.75rem);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 5rem; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 var(--step-0)/1.6 var(--sans);
  text-rendering: optimizeLegibility;
}
html[lang^="zh"] body { font-family: var(--cjk); line-height: 1.8; letter-spacing: 0.02em; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--teal); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { color: var(--deep); text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--tan); outline-offset: 3px; border-radius: 4px; }

.wrap { width: min(100% - 2.5rem, var(--wrap)); margin-inline: auto; }
.skip { position: absolute; left: -999px; top: 0; }
.skip:focus { left: 1rem; top: 1rem; background: var(--white); padding: .5rem 1rem; z-index: 10; }

h1, h2, h3 { line-height: 1.15; font-weight: 750; letter-spacing: -0.015em; margin: 0 0 .6em; text-wrap: balance; }
html[lang^="zh"] :is(h1, h2, h3) { letter-spacing: 0.01em; line-height: 1.35; font-weight: 700; }
h1 { font-size: var(--step-4); }
h2 { font-size: var(--step-3); }
h3 { font-size: var(--step-1); }
p { margin: 0 0 1em; }
.lede { font-size: var(--step-1); color: var(--muted); max-width: 40ch; }
html[lang^="zh"] .lede { max-width: 32em; }

/* Header */
.site-head { position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--paper) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid transparent; }
.site-head.scrolled { border-bottom-color: var(--line); }
.site-head .wrap { display: flex; align-items: center; gap: 1.25rem; min-height: 4.25rem; }
.brand { display: flex; align-items: center; gap: .6rem; color: var(--ink); text-decoration: none; font-weight: 750; font-size: 1.125rem; }
.brand svg { width: 34px; height: 34px; border-radius: 9px; }
.brand:hover { color: var(--ink); }
.nav { display: flex; gap: 1.25rem; margin-left: auto; align-items: center; }
.nav a { color: var(--ink); text-decoration: none; font-size: var(--step--1); font-weight: 600; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--teal); text-decoration: underline; }
.nav .btn-primary, .nav .btn-primary:hover { color: var(--white); text-decoration: none; }
.nav .lang { border: 1px solid var(--line); border-radius: 999px; padding: .2rem .7rem; }
@media (max-width: 860px) { .nav .opt { display: none; } }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: .55rem; border-radius: 999px; padding: .8rem 1.35rem; font-weight: 700; text-decoration: none; line-height: 1.2; }
.btn-primary { background: var(--teal); color: var(--white); }
.btn-primary:hover { background: var(--deep); color: var(--white); text-decoration: none; }
.btn-small { padding: .45rem .95rem; font-size: var(--step--1); }
.btn svg { width: 1.1em; height: 1.1em; flex: none; }
.store { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1.25rem; margin-top: 1.75rem; }
.store .note { font-size: var(--step--1); color: var(--muted); margin: 0; max-width: 34ch; }

/* Hero */
.hero { position: relative; overflow: hidden; padding: 3.5rem 0 4.5rem; }
.hero .wrap { position: relative; display: grid; grid-template-columns: 1.15fr .85fr; gap: 3rem; align-items: center; }
.hero h1 { max-width: 15ch; }
html[lang^="zh"] .hero h1 { max-width: 12em; }
.hero .phone { justify-self: center; width: min(100%, 360px); position: relative; z-index: 1; }
.trail { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.trail path { fill: none; stroke: var(--mint); stroke-width: 34; stroke-linecap: round; }
.trail .dot { fill: var(--tan); }
.trail text { font: 600 15px var(--sans); fill: var(--tan-ink); }
html[lang^="zh"] .trail text { font-family: var(--cjk); }
@media (prefers-reduced-motion: no-preference) {
  .trail path { stroke-dasharray: 2600; stroke-dashoffset: 2600; animation: draw 1.8s .2s cubic-bezier(.45,.05,.3,1) forwards; }
  .trail g { opacity: 0; animation: appear .4s forwards; }
  .trail g:nth-of-type(1) { animation-delay: .7s; }
  .trail g:nth-of-type(2) { animation-delay: 1.1s; }
  .trail g:nth-of-type(3) { animation-delay: 1.5s; }
}
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes appear { to { opacity: 1; } }
@media (max-width: 820px) {
  .hero { padding-top: 2rem; }
  .hero .wrap { grid-template-columns: 1fr; }
  .hero .phone { width: min(86%, 340px); }
  .trail text { display: none; }
}

/* Screens */
.screen { border-radius: 22px; overflow: hidden; background: #F3F5EE; border: 1px solid var(--line); box-shadow: 0 24px 48px -28px rgba(16, 77, 67, .45); }
.screen img { width: 100%; }
figure { margin: 0; }
figcaption { font-size: var(--step--1); color: var(--muted); margin-top: .6rem; }

/* Sections */
section { padding: 4.5rem 0; }
.story, .band { background: var(--mint); }
.story h2 { font-size: var(--step-1); color: var(--teal); margin-bottom: .8rem; }
.also-h { margin-top: 3.5rem; }
.story .wrap { display: grid; grid-template-columns: 4rem 1fr; gap: 1.5rem; }
.story blockquote { margin: 0; font-size: var(--step-2); line-height: 1.45; max-width: 34ch; font-weight: 500; }
html[lang^="zh"] .story blockquote { max-width: 24em; font-size: var(--step-1); line-height: 1.9; }
.story cite { display: block; margin-top: 1rem; font-style: normal; font-size: var(--step-0); color: var(--muted); }
.story .paw { width: 3.25rem; height: 3.25rem; }

.feature { display: grid; grid-template-columns: 1fr 1fr; gap: 3.5rem; align-items: center; padding: 3rem 0; }
.feature + .feature { border-top: 1px solid var(--line); }
.feature .screen { width: min(100%, 380px); justify-self: center; }
.feature:nth-child(even) .screen { order: -1; }
.feature h3 { font-size: var(--step-2); }
.feature ul { padding-left: 1.1rem; margin: 0 0 1.25rem; }
.feature li { margin-bottom: .35rem; }
.feature li::marker { color: var(--teal); }
@media (max-width: 820px) {
  .feature { grid-template-columns: 1fr; gap: 2rem; }
  .feature:nth-child(even) .screen { order: 0; }
}

.also { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 2rem 3rem; margin-top: 2rem; }
.also h3 { margin-bottom: .3rem; }
.also p { color: var(--muted); margin: 0; }

.promises { list-style: none; padding: 0; margin: 2rem 0 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 1.25rem 3rem; }
.promises li { padding-left: 2rem; position: relative; }
.promises li::before { content: ""; position: absolute; left: 0; top: .45em; width: 1.1rem; height: .6rem; border-left: 3px solid var(--teal); border-bottom: 3px solid var(--teal); transform: rotate(-45deg); }

/* FAQ */
.faq-list { max-width: 48rem; margin-top: 1.5rem; }
details.faq { border-top: 1px solid var(--line); }
details.faq:last-child { border-bottom: 1px solid var(--line); }
details.faq summary { cursor: pointer; list-style: none; padding: 1.1rem 2.5rem 1.1rem 0; font-weight: 700; position: relative; }
details.faq summary::-webkit-details-marker { display: none; }
details.faq summary::after { content: "+"; position: absolute; right: .25rem; top: .85rem; font-size: 1.5rem; color: var(--teal); font-weight: 400; transition: transform .2s; }
details.faq[open] summary::after { transform: rotate(45deg); }
details.faq .a { padding: 0 0 1.25rem; color: var(--muted); max-width: var(--measure); }

/* CTA band */
.cta { background: var(--deep); color: var(--paper); }
.cta .wrap { display: flex; flex-wrap: wrap; gap: 2rem; align-items: center; justify-content: space-between; }
.cta h2 { margin: 0 0 .4rem; }
.cta p { margin: 0; color: #CFE0D7; max-width: 46ch; }
.cta .btn-primary { background: var(--paper); color: var(--deep); }
.cta .btn-primary:hover { background: var(--white); color: var(--deep); }
.cta a:not(.btn) { color: var(--tan); }

/* Article pages */
.page-head { padding: 3rem 0 2rem; }
.crumbs { font-size: var(--step--1); color: var(--muted); margin-bottom: 1.25rem; }
.crumbs a { color: var(--muted); }
.crumbs span[aria-hidden] { margin: 0 .4rem; }
.article { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 4rem; align-items: start; padding-bottom: 4rem; }
.article.no-aside { grid-template-columns: minmax(0, 46rem); }
.prose { max-width: var(--measure); }
html[lang^="zh"] .prose { max-width: 40em; }
.prose h2 { font-size: var(--step-2); margin-top: 2.2em; }
.prose h3 { margin-top: 1.6em; }
.prose ul, .prose ol { padding-left: 1.3rem; }
.prose li { margin-bottom: .4rem; }
.prose li::marker { color: var(--teal); font-weight: 700; }
.prose table { border-collapse: collapse; width: 100%; margin: 1rem 0 1.5rem; font-size: var(--step--1); }
.prose th, .prose td { text-align: left; padding: .6rem .75rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.prose th { background: var(--mint); }
.prose .callout { background: var(--white); border-left: 4px solid var(--tan); padding: 1rem 1.25rem; border-radius: 0 12px 12px 0; margin: 1.5rem 0; }
.prose .callout p:last-child { margin: 0; }
.aside { position: sticky; top: 6rem; display: grid; gap: 1.25rem; }
.aside .box { background: var(--white); border: 1px solid var(--line); border-radius: 18px; padding: 1.25rem; }
.aside .box p { font-size: var(--step--1); color: var(--muted); }
.aside .box h2 { font-size: var(--step-1); margin-bottom: .4rem; }
@media (max-width: 900px) {
  .article { grid-template-columns: 1fr; gap: 2rem; }
  .aside { position: static; }
  .aside .screen { max-width: 340px; }
}
.inline-shot { max-width: 320px; margin: 1.5rem 0 2rem; }
.meta { font-size: var(--step--1); color: var(--muted); }

.guide-list { list-style: none; padding: 0; margin: 2rem 0 4rem; display: grid; gap: 0; max-width: 48rem; }
.guide-list li { border-top: 1px solid var(--line); padding: 1.5rem 0; }
.guide-list li:last-child { border-bottom: 1px solid var(--line); }
.guide-list a { font-size: var(--step-1); font-weight: 700; }
.guide-list p { margin: .3rem 0 0; color: var(--muted); }

.checklist { list-style: none; padding-left: 0 !important; }
.checklist li { padding-left: 2rem; position: relative; }
.checklist li::before { content: ""; position: absolute; left: 0; top: .3em; width: 1.1rem; height: 1.1rem; border: 2px solid var(--teal); border-radius: 5px; background: var(--white); }

/* Articles */
.post { padding-bottom: 4rem; }
.note-app { margin-top: 2.5rem; padding-top: 1.25rem; border-top: 1px solid var(--line); font-size: var(--step--1); color: var(--muted); }
.post-head { padding: 3rem 0 1.5rem; max-width: 46rem; }
.post-head h1 { font-size: var(--step-4); }
.post .prose { max-width: 42rem; font-size: 1.125rem; }
html[lang^="zh"] .post .prose { max-width: 38em; }
.post .prose p { margin-bottom: 1.15em; }
.post .prose blockquote { margin: 1.5rem 0; padding-left: 1.25rem; border-left: 3px solid var(--teal); color: var(--ink); font-size: var(--step-1); }
.card-meta { display: flex; gap: .75rem; align-items: center; font-size: var(--step--1); color: var(--muted); margin: 0 0 .4rem; }
.cat { color: var(--tan-ink); font-weight: 700; text-decoration: none; }
a.cat:hover { color: var(--deep); }
.byline { font-size: var(--step--1); color: var(--muted); margin-top: 1.25rem; }
.byline .mins::before { content: "/"; margin: 0 .5rem; color: var(--line); }
.hook { display: grid; grid-template-columns: 3rem 1fr; gap: 1rem; background: var(--white); border: 1px solid var(--line); border-radius: 18px; padding: 1.25rem 1.4rem; margin: 2.5rem 0; }
.hook svg { width: 3rem; height: 3rem; border-radius: 12px; }
.hook p { margin: 0; }
.hook .store { margin-top: 1rem; }
.sources { margin-top: 2.5rem; font-size: var(--step--1); color: var(--muted); }
.sources h2 { font-size: var(--step-0) !important; margin: 0 0 .5rem !important; color: var(--ink); }
.sources ol { padding-left: 1.2rem; }
.sources a { color: var(--muted); word-break: break-word; }
.more { margin-top: 3.5rem; border-top: 1px solid var(--line); padding-top: 2rem; }
.more h2 { font-size: var(--step-2); }
.article-list { list-style: none; padding: 0; margin: 1.5rem 0 2rem; display: grid; grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr)); gap: 2rem 3rem; }
.article-list li p:last-child { color: var(--muted); margin: 0; }
.card-title { font-size: var(--step-1) !important; margin: 0 0 .4rem !important; line-height: 1.3; }
.card-title a { color: var(--ink); text-decoration: none; }
.card-title a:hover { color: var(--teal); text-decoration: underline; }
.article-list.wide { grid-template-columns: 1fr; max-width: 46rem; gap: 0; }
.article-list.wide li { border-top: 1px solid var(--line); padding: 1.5rem 0; }
.article-list.wide .card-title { font-size: var(--step-2) !important; }
.pager { display: flex; gap: 2rem; margin: 1rem 0 2rem; font-weight: 700; }
.feed { font-size: var(--step--1); margin-bottom: 4rem; }
@media (max-width: 1000px) { .nav a[href$="/guides/"] { display: none; } }

/* Language hint */
.lang-hint { background: var(--ink); color: var(--paper); font-size: var(--step--1); }
.lang-hint .wrap { display: flex; gap: 1rem; align-items: center; min-height: 2.75rem; }
.lang-hint a { color: var(--tan); font-weight: 700; }
.lang-hint button { margin-left: auto; background: none; border: 0; color: inherit; font: inherit; cursor: pointer; padding: .4rem; }

/* Footer */
.site-foot { border-top: 1px solid var(--line); padding: 3rem 0 2.5rem; font-size: var(--step--1); color: var(--muted); }
.site-foot .cols { display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); gap: 2rem; }
.site-foot h2 { font-size: var(--step-0); color: var(--ink); margin-bottom: .6rem; }
.site-foot ul { list-style: none; padding: 0; margin: 0; }
.site-foot li { margin-bottom: .35rem; }
.site-foot a { color: var(--muted); }
.site-foot a:hover { color: var(--teal); }
.site-foot .fine { margin-top: 2.5rem; }
@media (max-width: 760px) { .site-foot .cols { grid-template-columns: 1fr 1fr; } }

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