/*
 * Visual theme layer (colors, type, surfaces). Loaded after styles.css on
 * every page; removing its <link> restores the previous look. Layout and
 * behavior stay in styles.css.
 *
 * Color roles: actions (buttons) are black; states (active tab, focus,
 * links) use --brand. Sector chips keep their three hues, muted.
 */

:root {
  --font-main: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, system-ui, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;

  --ink: #111827;
  --muted: #4b5563;
  --subtle: #6b7280;
  --line: #e5e7eb;
  --surface: #f7f8fa;
  --paper: #ffffff;
  --brand: #0f766e;
  --brand-soft: #e6f2f1;
  --action: #111827;
  --action-hover: #374151;

  /* One page gutter for every section: 16px on phones, then a 1120px column */
  --page-gutter: max(16px, calc((100% - 1120px) / 2));

  --radius-s: 6px;
  --radius-m: 12px;
  --radius-pill: 999px;
  --shadow-card: 0 1px 2px rgba(17, 24, 39, 0.06);
}

html body {
  font-family: var(--font-main);
  color: var(--ink);
  background: var(--paper);
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
}

/* No decorative click ripple */
.page-ripple {
  display: none;
}

/* ---------- Header ---------- */
html body .site-header {
  /* Same left edge as the 1120px content column below */
  padding-left: var(--page-gutter);
  padding-right: var(--page-gutter);
  border-bottom: 1px solid var(--line);
  background: var(--paper);
  box-shadow: none;
}

html body .site-header .brand {
  gap: 0;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--ink);
}

/* Wordmark only: the multicolor mark is retired */
html body .site-header .brand .brand-mark {
  display: none;
}

html body .main-nav a {
  color: var(--ink);
  font-weight: 600;
}

html body .main-nav a:hover,
html body .main-nav a.active,
html body .main-nav a[aria-current="page"] {
  color: var(--brand);
}

html body .header-actions .text-button {
  color: var(--muted);
  font-weight: 500;
}

html body .header-actions .auth-link {
  padding: 0 16px;
  min-height: 38px;
  border-radius: var(--radius-s);
  background: var(--action);
  color: #fff;
  font-weight: 700;
}

html body .header-actions .auth-link:hover {
  background: var(--action-hover);
  color: #fff;
}

/* ---------- Hero ---------- */
html body .hero {
  background: var(--paper);
  border-bottom: 0;
}

html body .hero {
  padding-left: var(--page-gutter);
  padding-right: var(--page-gutter);
}

html body .hero-copy {
  width: 100%;
  max-width: none;
  margin: 0;
  text-align: left;
  align-items: flex-start;
}

html body .hero .eyebrow {
  color: var(--brand);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0;
}

html body .hero h1 {
  margin: 8px 0 0;
  font-size: 44px;
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -0.04em;
  color: var(--ink);
  word-break: keep-all;
}

html body .hero .hero-description {
  margin-top: 12px;
  color: var(--muted);
  font-size: 17px;
}

html body .hero .search-panel {
  width: min(640px, 100%);
  margin: 28px 0 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

html body .hero .search-field {
  min-height: 56px;
  padding: 0 22px;
  border: 1.5px solid var(--ink);
  border-radius: var(--radius-pill);
  background: var(--paper);
  box-shadow: none;
}

html body .hero .search-field:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}

html body .hero .search-field input {
  font-size: 16px;
  color: var(--ink);
}

html body .hero .search-field input::placeholder {
  color: var(--subtle);
}

/* List section and the sections below share the same gutter */
html body .marketplace,
html body .seo-topic-section,
html body .site-footer {
  padding-left: var(--page-gutter);
  padding-right: var(--page-gutter);
}

html body .marketplace .content-area,
html body .seo-topic-inner {
  width: 100%;
  max-width: none;
  margin-left: 0;
  margin-right: 0;
}

/* ---------- Sector tabs ---------- */
html body .sector-tabs {
  border-bottom: 1px solid var(--line);
}

html body .sector-tabs button {
  color: var(--muted);
  font-weight: 600;
}

html body .sector-tabs button:hover {
  color: var(--ink);
}

html body .sector-tabs button.active {
  color: var(--ink);
  font-weight: 700;
  box-shadow: inset 0 -2px 0 var(--ink);
  border-color: transparent;
}

/* Other boards' tab bars follow the same active style */
html body [role="tablist"] button.active {
  color: var(--ink);
  border-color: var(--ink);
}

/* ---------- Ingredient list (table look) ---------- */
html body .ingredient-board-head {
  background: var(--surface);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

html body .ingredient-grid .ingredient-card {
  min-height: 0;
  padding-top: 16px;
  padding-bottom: 16px;
  border-radius: 0;
  border-color: var(--line);
  background: var(--paper);
  box-shadow: none;
  transition: background-color 120ms ease;
}

html body .ingredient-grid .ingredient-card:hover {
  background: var(--surface);
  transform: none;
  box-shadow: none;
}

html body .ingredient-card h3 {
  color: var(--ink);
  font-size: 16px;
  font-weight: 700;
}

html body .ingredient-card h3 span,
html body .ingredient-card .ingredient-desc,
html body .ingredient-card .ingredient-lead-time {
  color: var(--muted);
}

html body .ingredient-card .ingredient-manufacturer,
html body .ingredient-card .ingredient-origin {
  color: var(--muted);
  font-size: 13px;
}

/* Sector chips: same three hues, muted, AA contrast */
html body .sector-label {
  border: 1px solid transparent;
  border-radius: var(--radius-s);
  font-size: 12px;
  font-weight: 600;
}

html body .sector-label.sector-식품 {
  background: #eef6f1;
  border-color: #d3e8db;
  color: #1e6b45;
}

html body .sector-label.sector-제약 {
  background: #eef3fa;
  border-color: #d5e1f1;
  color: #2a4f86;
}

html body .sector-label.sector-화장품 {
  background: #f8eff3;
  border-color: #ecd6e0;
  color: #8a3358;
}

/* Row buttons: small grey outline */
html body .card-actions button,
html body .detail-actions .outline-button,
html body .detail-actions .quote-button {
  min-height: 32px;
  border-radius: var(--radius-s);
  background: var(--paper);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  box-shadow: none;
}

html body .card-actions button:hover {
  transform: none;
  background: var(--surface);
}

html body .favorite-button.active,
html body .favorite-button:hover {
  color: #a87b00;
}

/* ---------- Pagination ---------- */
html body .page-number-list button {
  border-radius: var(--radius-s);
  border-color: var(--line);
  background: var(--paper);
  color: var(--muted);
  font-weight: 600;
}

html body .page-number-list button.active {
  border-color: var(--action);
  background: var(--action);
  color: #fff;
}

/* ---------- Primary buttons ---------- */
html body .primary-button {
  border-color: var(--action);
  border-radius: var(--radius-s);
  background: var(--action);
  color: #fff;
  box-shadow: none;
}

html body .primary-button:hover {
  border-color: var(--action-hover);
  background: var(--action-hover);
}

html body .outline-button {
  border-radius: var(--radius-s);
  border-color: var(--line);
  color: var(--ink);
  box-shadow: none;
}

/* ---------- Info section & footer ---------- */
html body .seo-topic-section {
  background: var(--surface);
  border-top: 1px solid var(--line);
}

html body .seo-topic-section h2 {
  color: var(--ink);
  font-weight: 800;
  letter-spacing: -0.03em;
}

html body .seo-topic-grid a {
  padding: 22px;
  border-radius: var(--radius-m);
  border: 1px solid var(--line);
  background: var(--paper);
  box-shadow: none;
}

html body .seo-topic-grid a::before {
  background: var(--brand);
}

html body .seo-topic-grid a:first-child {
  padding: 22px;
  border-left: 1px solid var(--line);
}

html body .seo-topic-grid a:hover strong {
  color: var(--brand);
}

/* Four guide cards: one row on desktop instead of 3 + 1 */
@media (min-width: 1000px) {
  html body .seo-topic-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
  }
}

@media (min-width: 721px) and (max-width: 999px) {
  html body .seo-topic-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
}

html body .seo-topic-grid a strong {
  color: var(--ink);
}

html body .seo-topic-grid a span {
  color: var(--muted);
}

html body .site-footer {
  background: var(--paper);
  border-top: 1px solid var(--line);
  color: var(--muted);
}

html body .site-footer strong {
  color: var(--ink);
  font-weight: 800;
  letter-spacing: -0.03em;
}

/* Focus: state color */
html body a:focus-visible,
html body button:focus-visible,
html body input:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

/* ---------- Mobile ---------- */
@media (max-width: 720px) {
  /* Wordmark + account actions on the first row, nav below */
  html body .site-header {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "brand actions"
      "nav nav";
    row-gap: 8px;
  }

  html body .site-header .brand {
    display: inline-flex;
    grid-area: brand;
    align-self: center;
    font-size: 19px;
  }

  html body .site-header .header-actions {
    grid-area: actions;
  }

  html body .site-header .main-nav {
    grid-area: nav;
  }

  html body .hero .search-field input {
    font-size: 15px;
  }

  html body .seo-topic-grid a,
  html body .seo-topic-grid a:first-child {
    padding: 18px;
    border: 1px solid var(--line);
  }

  html body .hero h1 {
    font-size: 28px;
    line-height: 1.3;
  }

  html body .hero .hero-description {
    font-size: 15px;
  }

  html body .hero .search-field {
    min-height: 50px;
    padding: 0 18px;
  }
}
