/* Shiori — shiori.study. Colors come from the app icon (scripts/make-icon.swift). */

:root {
  --paper: #faf6ef;
  --paper-2: #f2ebdf;
  --card: #ffffff;
  --ink: #1a2a42;
  --ink-2: #4a5872;
  --ink-3: #7a8499;
  --rule: #e4dccd;
  --navy: #1f3a60;
  --navy-hi: #29497a;
  --navy-lo: #1a3152;
  --orange: #e8893a;
  --orange-ink: #b8611b;
  --again: #c8553d;
  --hard: #9a7b2f;
  --good: #3f8a5a;
  --easy: #3b6fb0;
  --shadow: 0 1px 2px rgba(26, 42, 66, .06), 0 12px 32px rgba(26, 42, 66, .10);
  --serif: ui-serif, "New York", "Iowan Old Style", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", sans-serif;
  --jp: "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif JP", serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #111a28;
    --paper-2: #16223a;
    --card: #1b2840;
    --ink: #eef1f6;
    --ink-2: #b5bfd1;
    --ink-3: #8390a8;
    --rule: #2a3854;
    --orange-ink: #f0a160;
    --again: #e07a63;
    --hard: #d0b060;
    --good: #6cbf88;
    --easy: #79a6e0;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 12px 32px rgba(0, 0, 0, .35);
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 17px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--orange-ink); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }

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

.wrap { width: min(1080px, 100% - 32px); margin-inline: auto; }
.narrow { width: min(720px, 100% - 32px); margin-inline: auto; }

.skip { position: absolute; left: -999px; }
.skip:focus { left: 16px; top: 16px; background: var(--card); padding: 8px 12px; z-index: 10; }

/* Header */

.site-header { padding: 20px 0; }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font: 600 20px/1 var(--serif); }
.brand img { width: 32px; height: 32px; }
.site-nav { display: flex; gap: 20px; font-size: 15px; }
.site-nav a { color: var(--ink-2); text-decoration: none; }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--ink); }

/* Hero */

.hero { position: relative; padding: 48px 0 72px; overflow: hidden; }
.hero .wrap { display: grid; grid-template-columns: 1.05fr .95fr; gap: 56px; align-items: center; }
.eyebrow { font: 600 13px/1 var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--orange-ink); margin: 0 0 16px; }
h1 { font: 600 clamp(38px, 6vw, 60px)/1.08 var(--serif); letter-spacing: -.01em; margin: 0 0 20px; text-wrap: balance; }
.lede { font-size: 20px; color: var(--ink-2); margin: 0 0 32px; max-width: 34em; text-wrap: pretty; }

.badge {
  display: inline-flex; align-items: center; gap: 12px;
  padding: 10px 18px 10px 14px; border-radius: 12px;
  background: var(--ink); color: var(--paper);
  font: 500 15px/1.2 var(--sans);
}
.badge svg { width: 22px; height: 22px; flex: none; }
.badge small { display: block; font-size: 12px; opacity: .75; }
.badge strong { font-size: 17px; font-weight: 600; }
.hero-note { font-size: 14px; color: var(--ink-3); margin: 14px 0 0; }

/* The bookmark hangs from the top of the hero, behind the card, and its tail shows below it */
.ribbon {
  position: absolute; z-index: -1; right: 56px; top: -600px; bottom: -110px; width: 64px;
  background: var(--orange);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% calc(100% - 24px), 0 100%);
}
.ribbon::before, .ribbon::after {
  content: ""; position: absolute; background: #fff;
  clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}
.ribbon::before { width: 26px; height: 26px; left: 12px; bottom: 34px; }
.ribbon::after { width: 16px; height: 16px; left: 37px; bottom: 62px; }

/* Card illustration */

.demo { position: relative; z-index: 1; }
.flashcard {
  background: var(--card); border-radius: 18px; box-shadow: var(--shadow);
  border: 1px solid var(--rule); overflow: hidden;
}
.flashcard .bar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 16px; border-bottom: 1px solid var(--rule);
  font-size: 13px; color: var(--ink-3);
}
.flashcard .counts span { margin-left: 10px; font-variant-numeric: tabular-nums; }
.flashcard .counts .n { color: var(--easy); }
.flashcard .counts .l { color: var(--again); }
.flashcard .counts .r { color: var(--good); }
.flashcard .face { padding: 36px 24px 28px; text-align: center; }
.flashcard ruby { font: 500 64px/1.3 var(--jp); }
.flashcard rt { font-size: 18px; color: var(--ink-2); letter-spacing: .1em; }
.flashcard hr { border: 0; border-top: 1px solid var(--rule); margin: 22px auto; width: 70%; }
.flashcard .meaning { font: 500 22px/1.3 var(--serif); margin: 0 0 6px; }
.flashcard .example { font: 17px/1.5 var(--jp); color: var(--ink-2); margin: 0; }
.answers { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 0 16px 16px; }
.answers div {
  border: 1px solid var(--rule); border-radius: 10px; padding: 8px 4px 7px;
  text-align: center; font-size: 14px; font-weight: 600; line-height: 1.25;
}
.answers small { display: block; font-weight: 400; font-size: 12px; color: var(--ink-3); }
.answers kbd { font-size: 11px; padding: 0 5px; margin-left: 3px; }
.answers .again { color: var(--again); }
.answers .hard { color: var(--hard); }
.answers .good { color: var(--good); }
.answers .easy { color: var(--easy); }

kbd {
  font: 600 13px/1.6 var(--mono);
  display: inline-block; min-width: 1.7em; padding: 1px 7px; text-align: center;
  border: 1px solid var(--rule); border-bottom-width: 2px; border-radius: 6px;
  background: var(--card); color: var(--ink);
}

/* Sections */

section { padding: 72px 0; }
.alt { background: var(--paper-2); }
h2 { font: 600 clamp(28px, 4vw, 38px)/1.15 var(--serif); margin: 0 0 12px; text-wrap: balance; }
.section-lede { color: var(--ink-2); font-size: 19px; margin: 0 0 40px; max-width: 40em; }

.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.feature {
  background: var(--card); border: 1px solid var(--rule); border-radius: 14px; padding: 24px;
}
.feature h3 { font: 600 19px/1.3 var(--serif); margin: 12px 0 8px; }
.feature p { margin: 0; color: var(--ink-2); font-size: 16px; }
.feature .icon {
  width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center;
  background: color-mix(in srgb, var(--orange) 16%, transparent); color: var(--orange-ink);
}
.feature .icon svg { width: 22px; height: 22px; }

.keys { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 4px 40px; margin: 0; padding: 0; list-style: none; }
.keys li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--rule); color: var(--ink-2); }
.keys li span:first-child { flex: none; min-width: 128px; }

.split { display: grid; grid-template-columns: 1fr 1fr; gap: 56px; align-items: start; }
.checks { list-style: none; padding: 0; margin: 0; }
.checks li { position: relative; padding: 0 0 14px 30px; color: var(--ink-2); }
.checks li::before {
  content: ""; position: absolute; left: 0; top: 4px; width: 18px; height: 18px; border-radius: 50%;
  background: var(--good) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M5 10.5l3 3 7-7' fill='none' stroke='white' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/14px no-repeat;
}
.checks strong { color: var(--ink); }

.closing { text-align: center; }
.closing img { width: 96px; height: 96px; margin-bottom: 16px; }
.closing p { color: var(--ink-2); margin: 0 auto 28px; max-width: 32em; }

/* Text pages (privacy, support) */

.page { padding: 32px 0 80px; }
.page h1 { font-size: clamp(34px, 5vw, 46px); margin-bottom: 8px; }
.page .meta { color: var(--ink-3); margin: 0 0 40px; font-size: 15px; }
.page h2 { font-size: 26px; margin: 48px 0 12px; }
.page h3 { font: 600 19px/1.35 var(--serif); margin: 28px 0 6px; }
.page p, .page li { color: var(--ink-2); }
.page li { margin-bottom: 8px; }
.page strong { color: var(--ink); }
.callout {
  background: var(--card); border: 1px solid var(--rule); border-left: 4px solid var(--orange);
  border-radius: 10px; padding: 18px 22px; margin: 0 0 32px;
}
.callout p { margin: 0; color: var(--ink); }
.page code { font: 14px var(--mono); background: var(--paper-2); padding: 1px 5px; border-radius: 4px; }

/* Footer */

.site-footer { border-top: 1px solid var(--rule); padding: 32px 0 48px; font-size: 14px; color: var(--ink-3); }
.site-footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 20px; }
.site-footer a { color: var(--ink-2); text-decoration: none; }
.site-footer a:hover { color: var(--ink); text-decoration: underline; }

/* Phones and small windows */

@media (max-width: 860px) {
  .hero .wrap, .split { grid-template-columns: 1fr; gap: 40px; }
  .features { grid-template-columns: 1fr 1fr; }
  .hero { padding-bottom: 120px; }
  .ribbon { top: -40px; bottom: -96px; right: 32px; width: 56px; }
  .ribbon::before { left: 10px; }
  .ribbon::after { left: 32px; }
}

@media (max-width: 560px) {
  body { font-size: 16px; }
  .hero { padding: 24px 0 120px; }
  .lede { font-size: 18px; }
  .features { grid-template-columns: 1fr; }
  section { padding: 56px 0; }
  .site-nav { gap: 14px; }
  .site-nav .hide-sm { display: none; }
  .flashcard ruby { font-size: 52px; }
  .answers { gap: 6px; padding: 0 10px 12px; }
  .answers kbd { display: none; }
}

@media (prefers-reduced-motion: no-preference) {
  .flashcard { animation: rise .6s ease-out both; }
  @keyframes rise { from { transform: translateY(14px); } }
}
.split h2 { margin-bottom: 24px; }

/* Deck generator (/generators/) */

/* Flat sections divided by hairlines; the sample card is the only box. Two columns: the
   title, choosing and downloading on the left; the sample card and the picked kanji on the
   right, so both start at the top of the page. */
.generator { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 0 56px; align-items: start; }
.gen-col { display: flex; flex-direction: column; min-width: 0; }
.gen-intro { padding-bottom: 24px; }
.gen-intro h1 { margin: 0 0 6px; }
.gen-intro .meta { margin: 0; font-size: 17px; }
.gen-pick, .gen-options, .gen-preview { border-top: 1px solid var(--rule); padding: 22px 0 26px; }
.generator h2 { font: 600 19px/1.3 var(--serif); margin: 0 0 14px; }

.chips { border: 0; padding: 0; margin: 0 0 14px; display: flex; flex-wrap: wrap; gap: 6px; }
.chips legend { font-size: 11px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 7px; padding: 0; }
.chip {
  display: inline-flex; align-items: baseline; gap: 5px; cursor: pointer;
  font: 500 14px/1 var(--sans); color: var(--ink); background: transparent;
  border: 1px solid var(--rule); border-radius: 999px; padding: 7px 12px;
}
.chip small { font-size: 11px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.chip:hover { border-color: var(--ink-3); }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.chip[aria-pressed="true"] small { color: inherit; opacity: .7; }

.field { display: block; margin: 0 0 14px; }
.field > span { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.field textarea, .field input, .field select {
  width: 100%; font: 15px/1.5 var(--sans); color: var(--ink); background: var(--card);
  border: 1px solid var(--rule); border-radius: 8px; padding: 8px 11px;
}
.field textarea:focus, .field input:focus, .field select:focus { outline: 2px solid var(--orange); outline-offset: 0; border-color: transparent; }
.field textarea { font-family: var(--jp); resize: vertical; min-height: 76px; }
.field select { width: auto; min-width: 72px; }
.gen-pick .field { margin-bottom: 0; }
.check { display: flex; gap: 10px; align-items: flex-start; margin: 2px 0 18px; color: var(--ink-2); font-size: 15px; }
.check input { margin-top: 4px; accent-color: var(--orange); }

/* Download: the deck name and the example words side by side */
.gen-options { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 16px; align-items: end; }
.gen-options > h2, .gen-options > .check, .gen-options > .button, .gen-options > .gen-status { grid-column: 1 / -1; }
.gen-options > .button { justify-self: start; }

.button {
  display: inline-block; cursor: pointer; font: 600 15px/1 var(--sans); color: #fff;
  background: var(--navy); border: 0; border-radius: 10px; padding: 13px 20px;
}
.button:hover { background: var(--navy-hi); }
.button:disabled { opacity: .4; cursor: default; }
@media (prefers-color-scheme: dark) { .button { background: var(--orange); color: #1a1208; } .button:hover { background: #f0a160; } }

/* The sample card: segmented tabs over the one card on the page */
.card-demo { margin: 0 0 24px; }
.card-demo-tabs { display: flex; gap: 2px; padding: 3px; background: var(--paper-2); border-radius: 9px; margin-bottom: 10px; }
.card-demo-tabs button {
  flex: 1; font: 600 12px/1 var(--sans); color: var(--ink-3); background: none; border: 0; border-radius: 7px; padding: 8px 6px; cursor: pointer;
}
.card-demo-tabs button[aria-selected="true"] { background: var(--card); color: var(--ink); box-shadow: 0 1px 2px rgba(26, 42, 66, .12); }
.card-demo .sample-card {
  height: 300px; overflow: auto; cursor: pointer; overscroll-behavior: contain; padding: 16px;
  background: var(--card); border: 1px solid var(--rule); border-radius: 12px;
  box-shadow: 0 1px 2px rgba(26, 42, 66, .05), 0 10px 28px rgba(26, 42, 66, .08);
}
.card-demo .sample-card > * { flex-shrink: 0; }
.card-demo .sample-card .kanji { font-size: 80px; }
/* The back at about two thirds of the real card's size, so it fits without scrolling */
.card-demo [data-face-panel="back"] { font-size: 13px; line-height: 1.45; }
.card-demo [data-face-panel="back"] .kanji { font-size: 40px; }
.card-demo [data-face-panel="back"] hr { margin: 6px 0; }
.card-demo [data-face-panel="back"] .meanings { font-size: 15px; margin: 0 0 4px; }
.card-demo [data-face-panel="back"] .row, .card-demo [data-face-panel="back"] .meta { margin: 1px 0; }
.card-demo [data-face-panel="back"] .label, .card-demo [data-face-panel="back"] .meta { font-size: 11px; }
.card-demo [data-face-panel="back"] .diagram img { width: 64px; height: 64px; margin: 4px auto; }
.card-demo [data-face-panel="back"] .src { font-size: 9px; margin-top: 6px; }
.card-demo .prompt { font-size: 22px; }
.card-demo .sample-card[hidden] { display: none; }
.card-demo figcaption { font-size: 13px; color: var(--ink-3); margin-top: 8px; }

/* Picked kanji */
.gen-summary { font: 600 15px/1.3 var(--sans); margin: -4px 0 6px; }
.kanji-grid { display: flex; flex-wrap: wrap; gap: 4px; max-height: 300px; overflow: auto; }
.kanji-chip {
  width: 36px; height: 36px; display: grid; place-items: center; font: 20px/1 var(--jp); color: var(--ink);
  background: var(--paper-2); border: 1px solid transparent; border-radius: 7px; padding: 0; cursor: pointer;
}
.kanji-chip:hover { border-color: var(--ink-3); }
.kanji-chip[aria-pressed="false"] { opacity: .3; background: transparent; border-color: var(--rule); }
.pick-tools { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin: 0 0 10px; font-size: 13px; color: var(--ink-3); }
.pick-tools[hidden] { display: none; }
.link-button { font: 600 13px/1.4 var(--sans); color: var(--orange-ink); background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.gen-notice { font-size: 14px; color: var(--ink-3); margin: 12px 0 0; }
.gen-notice:empty, .gen-status:empty { display: none; }
.gen-status { margin: 14px 0 0; font-size: 15px; color: var(--ink-2); }
.gen-status.is-error { color: var(--again); }
.credits { padding-left: 20px; margin: 0 0 12px; }
.credits li { margin-bottom: 4px; font-size: 15px; }

@media (max-width: 860px) {
  /* One column in working order: choose, check, see the card, download. */
  .generator { display: flex; flex-direction: column; align-items: stretch; gap: 20px; }
  .gen-col { display: contents; }
  .gen-intro { order: 1; }
  .gen-pick { order: 2; }
  .gen-preview { order: 3; }
  .card-demo { order: 4; width: 100%; max-width: 380px; }
  .gen-options { order: 5; }
  .gen-bar { order: 6; }
  .kanji-grid { max-height: 320px; }
}

/* Sample cards on the generator page: the "Japanese Kanji" note type's look (server/internal/gen/jakanji/notetype.go) */

.sample-card {
  background: var(--paper); border: 1px solid var(--rule); border-radius: 12px; padding: 20px 16px;
  text-align: center; font: 16px/1.5 var(--sans); color: var(--ink); min-height: 180px;
  display: flex; flex-direction: column; justify-content: center;
}
.sample-card .kanji { font: 88px/1.15 var(--jp); }
.sample-card hr { border: 0; border-top: 1px solid var(--rule); width: 100%; margin: 12px 0; }
.sample-card .meanings { font-size: 20px; font-weight: 600; margin: 4px 0 8px; }
.sample-card .prompt { font-size: 24px; font-weight: 600; }
.sample-card .row { margin: 2px 0; }
.sample-card .label { color: var(--ink-3); font-size: 12px; margin-right: 6px; }
.sample-card .jp { font-family: var(--jp); }
.sample-card .meta { color: var(--ink-3); font-size: 12px; margin: 6px 0; }
.sample-card .diagram img { width: 120px; height: 120px; margin: 6px auto; display: block; }
.sample-card .src { color: var(--ink-3); font-size: 10px; margin-top: 10px; }
.sample-note rt { font-size: 10px; color: var(--ink-3); }


/* About the cards: page text under the tool, no box */
.gen-about { margin-top: 32px; border-top: 1px solid var(--rule); padding-top: 32px; max-width: 760px; }
.gen-about h2 { font-size: 22px; margin: 0 0 10px; }
.gen-about h2:not(:first-child) { margin-top: 28px; }

/* Phones: the kanji count and the download button stay at the bottom of the screen */
.gen-bar { display: none; }
@media (max-width: 860px) {
  .gen-bar:not([hidden]) {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    position: sticky; bottom: 0; z-index: 5; margin: 0 -16px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    background: var(--card); border-top: 1px solid var(--rule); box-shadow: 0 -6px 18px rgba(26, 42, 66, .10);
    font: 600 15px/1.3 var(--sans);
  }
  .gen-bar .button { padding: 12px 18px; }
}
@media (max-width: 560px) {
  .gen-options { grid-template-columns: 1fr; }
}
