/* Shared design tokens. Page layouts belong in styles.css or articles.css. */
:root {
  --ink: #0a1733;
  --red: #e62429;
  --red-hover: #bd171c;
  --paper: #f3f5f8;
  --surface: #fff;
  --line: #dbe1ea;
  --card-border: #cbd3df;
  --control-border: #bfc8d6;
  --muted: #647084;
  --header-muted: #b8c6df;
  --header-accent: #ff777b;
  --font-body: "Noto Sans JP", "Yu Gothic UI", "Yu Gothic", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
  --font-card-title: 1.02rem;
  --font-small: .8rem;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --radius: 4px;
  --radius-pill: 999px;
  --layout-wide: 1180px;
  --layout-article: 820px;
  --page-gutter: var(--space-6);
  --card-padding: var(--space-5);
}

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

html,
body {
  background: var(--paper);
}

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
}

button,
input {
  font-family: inherit;
}

a {
  color: inherit;
  text-underline-offset: 3px;
}

:where(a, button, input, summary):focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 3px;
}

/* Shared shell; each page stylesheet controls its width and spacing. */
.page-header {
  color: var(--surface);
  background: var(--ink);
  border-top: 7px solid var(--red);
}

.page-footer {
  margin: auto;
  border-top: 5px solid var(--ink);
  color: var(--muted);
  font-size: var(--font-small);
  line-height: 1.7;
}

.page-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  margin-top: var(--space-4);
  color: var(--ink);
  font-weight: 800;
}

/* Card variants share a title and surface, but keep their own layout. */
.card {
  min-width: 0;
  padding: var(--card-padding);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--surface);
  overflow-wrap: anywhere;
}

.card--row {
  padding: var(--space-4) 0;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
}

.card--guide {
  border-top: 4px solid var(--red);
  text-decoration: none;
}

.card--guide:hover {
  border-color: var(--red);
}

.card--pick {
  border-left: 4px solid var(--card-accent, var(--red));
}

.card-title {
  display: block;
  margin: 0;
  color: var(--ink);
  font-size: var(--font-card-title);
  font-weight: 800;
  line-height: 1.45;
}

/* Use button modifiers for destination/intent, never container-wide link styles. */
.button,
.buy,
.store-buy,
:where(.history-actions, .masterpiece-actions, .movie-book-actions) > a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 42px;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--control-border);
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--surface);
  font-family: inherit;
  font-size: var(--font-small);
  font-weight: 800;
  line-height: 1.4;
  text-align: center;
  text-decoration: none;
  overflow-wrap: anywhere;
  cursor: pointer;
}

.button:hover,
.buy:hover,
.store-buy:hover,
:where(.history-actions, .masterpiece-actions, .movie-book-actions) > a:hover {
  border-color: var(--ink);
  background: var(--paper);
}

.button--primary,
.button--amazon,
.movie-book-actions > a.amazon,
:is(.buy, .store-buy).amazon,
:where(.history-actions, .masterpiece-actions, .movie-book-actions) > a.primary {
  border-color: var(--red);
  color: var(--surface);
  background: var(--red);
}

.button--primary:hover,
.button--amazon:hover,
.movie-book-actions > a.amazon:hover,
:is(.buy, .store-buy).amazon:hover,
:where(.history-actions, .masterpiece-actions, .movie-book-actions) > a.primary:hover {
  border-color: var(--red-hover);
  background: var(--red-hover);
}

.button--dmm,
.movie-book-actions > a.dmm,
:is(.buy, .store-buy).dmm {
  border-color: #171717;
  color: var(--surface);
  background: #171717;
}

.button--dmm:hover,
.movie-book-actions > a.dmm:hover,
:is(.buy, .store-buy).dmm:hover {
  border-color: #000;
  background: #000;
}

@media (max-width: 760px) {
  :root {
    --page-gutter: var(--space-4);
    --card-padding: var(--space-4);
  }
}

/* Compatibility with store buttons emitted by the existing link generators. */
.button--rakuten,
.movie-book-actions > a.rakuten,
:is(.buy, .store-buy).rakuten {
  border-color: #bf0000;
  color: var(--surface);
  background: #bf0000;
}

.button--rakuten:hover,
.movie-book-actions > a.rakuten:hover,
:is(.buy, .store-buy).rakuten:hover {
  border-color: #970000;
  background: #970000;
}

/* Shared compact store buttons used by the catalogs. */
.store-buttons .buy { padding-inline: var(--space-2); }

/* Shared external link icon and screen-reader helper. */
.external-link-icon {
  display: inline-block;
  width: 1em;
  height: 1em;
  flex: none;
  vertical-align: -.1em;
  margin-inline-start: .3em;
}

:is(.product-link, .rating-provider-link, .rating-source-detail a, .source-detail a)::after {
  content: "";
  display: inline-block;
  width: .88em;
  height: .88em;
  margin-inline-start: .28em;
  background-color: currentColor;
  opacity: .75;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 3h7v7M21 3 10 14'/%3E%3Cpath d='M10 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-5'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 3h7v7M21 3 10 14'/%3E%3Cpath d='M10 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-5'/%3E%3C/svg%3E") center / contain no-repeat;
  vertical-align: -.08em;
}

:is(.history-actions, .masterpiece-actions, .movie-book-actions) > a::after {
  content: none;
  display: none;
}

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