/* anoni.net/esp32/ 的樣式。色票與版面照 anoni.net 品牌素材的「社群首頁的配色與版面」，
   token 跟 anoni-net/www 的 static/css/site.css 同名，品牌色只有 cyan，依用途分工：
   結構用中性灰階、層級用深色文字、互動用 cyan。不載入外部字型。 */

:root {
  --brand-cyan-200: #80d1ff;
  --brand-cyan-300: #4dbfff;
  --brand-cyan-400: #26b3ff;
  --brand-cyan-500: #00aeff;
  --brand-cyan-600: #009ee6;
  --brand-cyan-700: #0089bf;
  --brand-cyan-800: #006d99;
  --n-50: #f3f6f7;
  --n-100: #e3e9ec;
  --n-200: #cdd6da;
  --n-300: #a7b5bb;
  --c-bg: #ffffff;
  --c-text: #1d2b31;
  --c-strong: #13232a;
  --c-muted: #52646b;
  --c-hair: var(--n-100);
  --c-border: var(--n-200);
  --c-surface: var(--n-50);
  --c-line: var(--brand-cyan-500);
  --c-link: var(--brand-cyan-800);
  --c-accent: var(--brand-cyan-700);
  --c-solid: var(--brand-cyan-800);
  --c-active: var(--brand-cyan-600);
  /* 焦點外框跟底色要有 3:1（WCAG 1.4.11），cyan-500 在白底只有 2.5 */
  --c-focus: var(--brand-cyan-800);
  --radius: 8px;
  --frame: 58.5rem;
  --font: system-ui, -apple-system, "Segoe UI", "Noto Sans TC", "Noto Sans CJK TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --n-50: #082b3a;
    --n-100: #133847;
    --n-200: #234757;
    --n-300: #3c6070;
    --c-bg: #00202d;
    --c-text: #d8eef7;
    --c-strong: #ffffff;
    --c-muted: #9db7c2;
    --c-line: var(--brand-cyan-600);
    --c-link: var(--brand-cyan-200);
    --c-accent: var(--brand-cyan-300);
    --c-active: var(--brand-cyan-400);
    --c-focus: var(--brand-cyan-400);
  }
}

* { box-sizing: border-box; }
html { background: var(--c-bg); color: var(--c-text); font: 17px/1.75 var(--font); }
body { margin: 0; padding: 0 1rem; }
a { color: var(--c-link); text-underline-offset: .2em; }
a:focus-visible { outline: 2px solid var(--c-focus); outline-offset: 2px; border-radius: 2px; }
.sheet { max-width: var(--frame); margin: 0 auto; }

.skip { position: absolute; left: -999px; }
.skip:focus { left: 1rem; top: .5rem; background: var(--c-bg); padding: .25rem .5rem; z-index: 1; }

/* 頁首：手機兩列（品牌、導覽列），桌機併成一列，下面一條細線 */
header { padding-top: 1rem; border-bottom: 1px solid var(--c-hair); }
.brand { display: inline-flex; align-items: center; gap: .45rem; font-weight: 700; color: var(--c-strong); text-decoration: none; font-size: 1.05rem; }
.brand .logo { width: 1.6rem; height: 1.6rem; }
nav.main { display: flex; flex-wrap: wrap; gap: 0 1.25rem; margin-top: .4rem; }
nav.main a { padding: .45rem 0; text-decoration: none; color: var(--c-text); font-size: .95rem; white-space: nowrap; border-bottom: 2px solid transparent; margin-bottom: -1px; }
nav.main a[aria-current] { color: var(--c-strong); font-weight: 700; border-bottom-color: var(--c-active); }
nav.main a:hover { color: var(--c-accent); }
@media (min-width: 768px) {
  header { display: flex; align-items: center; justify-content: space-between; gap: 2rem; padding-top: 0; }
  nav.main { margin: 0; gap: 0 1.75rem; }
  nav.main a { padding: .95rem 0; }
}

/* 標題與段落：h1 1.8rem、h2 1.25rem、h3 1.05rem。h2 後面一條線，開頭 2.5rem 用識別色 */
h1 { color: var(--c-strong); font-size: 1.8rem; line-height: 1.3; margin: 1.5rem 0 .5rem; text-wrap: pretty; }
.lead { font-size: 1.1rem; font-weight: 500; margin: 0 0 1rem; max-width: 42rem; text-wrap: pretty; }
h2 { display: flex; align-items: center; gap: .6rem; color: var(--c-strong); font-size: 1.25rem; line-height: 1.4; margin: 2.5rem 0 .75rem; clear: both; }
h2::after {
  content: ""; flex: 1; height: 3px;
  background:
    linear-gradient(var(--c-accent), var(--c-accent)) left center / 2.5rem 3px no-repeat,
    linear-gradient(var(--c-hair), var(--c-hair)) left center / 100% 1px no-repeat;
}
h3 { color: var(--c-strong); font-size: 1.05rem; margin: 1.5rem 0 .25rem; }
p { margin: .5rem 0 1rem; }

/* 麵包屑：上一層的名稱，接一個箭頭指向下方的標題 */
.crumb { margin: 1.5rem 0 -1rem; font-size: .85rem; }
.crumb a { color: var(--c-muted); text-decoration: none; }
.crumb a:hover { color: var(--c-accent); text-decoration: underline; }
.crumb a::after { content: " ›"; color: var(--c-muted); margin-right: .3rem; }
.crumb + h1 { margin-top: 1.25rem; }

/* 按鈕：線框是次要動作，實心是主要動作（白字配 cyan-800，對比 5.6） */
.actions { display: flex; flex-wrap: wrap; gap: .75rem; margin: 1.25rem 0; }
.btn { display: inline-block; padding: .55rem 1.1rem; border: 1px solid var(--c-line); border-radius: var(--radius); color: var(--c-link); text-decoration: none; font-weight: 600; }
.btn:hover { border-color: var(--c-accent); background: var(--c-surface); }
.btn.solid { background: var(--c-solid); border-color: var(--c-solid); color: #fff; }
.btn.solid:hover { background: var(--brand-cyan-700); }
.btn:focus-visible { outline: 2px solid var(--c-focus); outline-offset: 2px; }

/* 首頁 */
.hero { padding: 1rem 0 .5rem; }
@media (min-width: 760px) {
  .hero { display: grid; grid-template-columns: 1fr 15rem; gap: 3rem; align-items: center; }
  .hero figure.phone { float: none; margin: 1.5rem 0 0; }
}
/* 首頁的面板只露出上半部，看得到警示的狀態就好 */
.hero-shot a { display: block; max-height: 22rem; overflow: hidden; border-radius: 1rem; border: 1px solid var(--c-border); }
.hero-shot img { border: 0; border-radius: 0; }
.hero-shot a:hover { border-color: var(--c-line); }
.hero h1 { font-size: 2.1rem; }
.cards { list-style: none; padding: 0; margin: 0; display: grid; gap: 1rem; }
@media (min-width: 640px) { .cards { grid-template-columns: repeat(2, 1fr); } }
.card { border: 1px solid var(--c-border); border-radius: var(--radius); padding: 1rem 1.25rem; position: relative; }
.card:hover { border-color: var(--c-line); }
.card h3 { margin-top: 0; font-size: 1.15rem; }
.card h3 a { text-decoration: none; color: var(--c-strong); }
.card h3 a::after { content: ""; position: absolute; inset: 0; }
.card h3 a:focus-visible { outline: none; }
.card:has(h3 a:focus-visible) { outline: 2px solid var(--c-focus); outline-offset: 2px; }
.card .meta { color: var(--c-muted); font-size: .9rem; margin-bottom: .5rem; }
/* 卡片整塊可以點，裡面的第二個連結要疊在上面才按得到 */
.card .more { position: relative; z-index: 1; margin: 0; font-size: .95rem; }
.steps { padding-left: 1.4rem; max-width: 42rem; }
.steps li { margin: .4rem 0; }

/* 內文 */
.prose { max-width: 42rem; }
.prose ul, .prose ol { padding-left: 1.4rem; }
.prose li { margin: .25rem 0; }
.prose code { font-size: .88em; background: var(--c-surface); padding: .05em .3em; border-radius: 4px; overflow-wrap: anywhere; }
.prose pre { overflow-x: auto; background: var(--c-surface); border-radius: var(--radius); padding: .75rem 1rem; font-size: .85rem; line-height: 1.5; }
.prose pre code { background: none; padding: 0; }
.table { overflow-x: auto; }
.prose table { border-collapse: collapse; width: 100%; font-size: .92rem; margin: 1rem 0; }
.prose th, .prose td { border-bottom: 1px solid var(--c-hair); padding: .4rem .5rem; text-align: left; vertical-align: top; }
.prose th { background: var(--c-surface); }
.note { background: var(--c-surface); border-radius: var(--radius); padding: .75rem 1rem; }

/* 面板的截圖：桌機放在段落右側，手機置中 */
figure.phone { margin: .5rem auto 1.5rem; width: min(100%, 15rem); }
figure.phone img { display: block; width: 100%; height: auto; border: 1px solid var(--c-border); border-radius: 1rem; }
figure.phone a:hover img { border-color: var(--c-line); }
figure.phone figcaption { font-size: .85rem; color: var(--c-muted); text-align: center; margin-top: .35rem; }
@media (min-width: 760px) {
  .prose { max-width: none; }
  .prose > :not(figure):not(h2):not(.table) { max-width: 42rem; }
  figure.phone { float: right; margin: .25rem 0 1.5rem 2rem; }
}

/* OLED 的畫面：128×64 的點陣放大，保持銳利 */
.oled { display: grid; grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); gap: 1rem; margin: 1rem 0 1.5rem; clear: both; }
.oled figure { margin: 0; }
.oled img { display: block; width: 100%; height: auto; image-rendering: pixelated; border-radius: 4px; background: #000; }
.oled figcaption { font-size: .85rem; color: var(--c-muted); margin-top: .3rem; }

/* 版本資訊 */
.version { display: grid; grid-template-columns: max-content 1fr; gap: .2rem 1rem; background: var(--c-surface); border-radius: var(--radius); padding: .75rem 1rem; font-size: .92rem; }
.version dt { color: var(--c-muted); }
.version dd { margin: 0; overflow-wrap: anywhere; }

/* 模擬面板：桌機左邊是情境、右邊是手機大小的面板，手機上情境在上面 */
.demo { display: grid; gap: 1.5rem; margin: 1.5rem 0; }
@media (min-width: 760px) { .demo { grid-template-columns: 1fr 390px; align-items: start; } }
.scenarios { list-style: none; padding: 0; margin: 0; display: grid; gap: .5rem; }
.scenarios a { display: block; border: 1px solid var(--c-border); border-radius: var(--radius); padding: .6rem .9rem; text-decoration: none; color: var(--c-text); }
.scenarios a:hover { border-color: var(--c-line); }
.scenarios strong { display: block; color: var(--c-link); }
.scenarios span { font-size: .9rem; color: var(--c-muted); }
.scenarios li:target a { border-color: var(--c-active); }
.device { justify-self: center; width: 100%; max-width: 390px; }
.device iframe { display: block; width: 100%; height: 760px; border: 1px solid var(--c-border); border-radius: 1.25rem; background: #fff; }

footer { margin-top: 3rem; padding: 1rem 1rem 1.5rem; background: var(--c-surface); font-size: .9rem; color: var(--c-muted); border-radius: var(--radius) var(--radius) 0 0; }
footer p { margin: .25rem 0; }
