@import url('https://cdn.jsdelivr.net/gh/sunn-us/SUIT/fonts/static/woff2/SUIT.css');
@import url('https://cdn.jsdelivr.net/gh/wanteddev/wanted-sans@v1.0.3/packages/wanted-sans/dist/web/static/wanted-sans.css');

:root {
  --bg: #F7F5F0;
  --fg: #253432;
  --muted: #626F69;
  --surface: #FFFFFF;
  --accent: #356A61;
  --accent-fg: #FFFFFF;
  --border: #D9E0DA;
  --radius: 10px;
  --surface-soft: #EDF2EE;
  --brow: #78586E;
  --brow-soft: #F2EBF0;
  --nail: #9B5736;
  --nail-soft: #F9EEE5;
  --warning: #94621D;
  --warning-soft: #FBF1DC;
  --danger: #A13E43;
  --focus: #2B776B;
  --font-body: 'SUIT', system-ui, sans-serif;
  --font-display: 'Wanted Sans', 'SUIT', system-ui, sans-serif;
  --line-height: 1.65;
  --space-xs: 0.375rem;
  --space-sm: 0.625rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2.25rem;
  --header-h: 3.75rem;
  --content-max: 44rem;
  --shadow-soft: 0 1px 2px rgba(37, 52, 50, 0.06);
}

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

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: var(--line-height);
  background: var(--bg);
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.35;
  margin: 0 0 var(--space-sm);
}

p {
  margin: 0 0 var(--space-md);
}

a {
  color: var(--accent);
}

button,
input {
  font: inherit;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-main {
  flex: 1;
  width: 100%;
  max-width: calc(var(--content-max) + 2rem);
  margin: 0 auto;
  padding: var(--space-lg) var(--space-md) var(--space-xl);
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
}

.site-header__inner {
  max-width: calc(var(--content-max) + 2rem);
  margin: 0 auto;
  padding: var(--space-sm) var(--space-md);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-sm) var(--space-md);
}

.site-brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.125rem;
  color: var(--fg);
  text-decoration: none;
  margin-right: auto;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  align-items: center;
}

.site-nav__link {
  font-size: 0.9375rem;
  color: var(--fg);
  text-decoration: none;
  padding: var(--space-xs) var(--space-sm);
  border-radius: calc(var(--radius) - 2px);
}

.site-nav__link.router-link-active {
  background: var(--surface-soft);
  color: var(--accent);
  font-weight: 600;
}

.site-nav__link--muted {
  color: var(--muted);
  cursor: default;
}

.site-search {
  display: flex;
  align-items: stretch;
  flex: 1 1 12rem;
  min-width: 0;
  max-width: 16rem;
}

.site-search__input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--border);
  border-right: none;
  border-radius: var(--radius) 0 0 var(--radius);
  padding: 0.5rem 0.75rem;
  background: var(--bg);
  color: var(--fg);
}

.site-search__input:focus {
  outline: 2px solid var(--focus);
  outline-offset: 0;
  z-index: 1;
}

.site-search__btn {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--accent-fg);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 0 0.875rem;
  cursor: pointer;
  font-weight: 600;
}

.site-auth-link {
  font-size: 0.9375rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  padding: 0.55rem 1rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

.btn--primary {
  background: var(--accent);
  color: var(--accent-fg);
  border-color: var(--accent);
}

.btn--ghost {
  background: transparent;
  color: var(--accent);
  border-color: var(--border);
}

.btn--block {
  width: 100%;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.link-btn {
  background: none;
  border: none;
  padding: 0;
  color: var(--accent);
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.link-btn:disabled {
  color: var(--muted);
  cursor: not-allowed;
}

/* Tags */
.tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  vertical-align: middle;
}

.tag--brow {
  background: var(--brow-soft);
  color: var(--brow);
}

.tag--nail {
  background: var(--nail-soft);
  color: var(--nail);
}

.tag--warning {
  background: var(--warning-soft);
  color: var(--warning);
}

.tag--accent {
  background: var(--surface-soft);
  color: var(--accent);
}

/* Home */
.hero__eyebrow {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: var(--space-xs);
}

.hero__title {
  font-size: clamp(1.5rem, 4vw, 2rem);
  max-width: 20ch;
}

.hero__lead {
  font-size: 1.0625rem;
  color: var(--muted);
  max-width: 36ch;
}

.entry-grid {
  display: grid;
  gap: var(--space-md);
  margin-top: var(--space-xl);
}

@media (min-width: 640px) {
  .entry-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.entry-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-lg);
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow-soft);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.entry-card--info:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 12px rgba(53, 106, 97, 0.12);
}

.entry-card--disabled {
  opacity: 0.92;
  background: var(--surface-soft);
}

.entry-card__label {
  font-size: 0.75rem;
  font-weight: 700;
  margin-bottom: var(--space-sm);
}

.entry-card__title {
  font-size: 1.25rem;
}

.entry-card__desc {
  color: var(--muted);
  flex: 1;
}

.entry-card__action {
  margin-top: var(--space-md);
  font-weight: 700;
  color: var(--accent);
}

.entry-card__action--muted {
  color: var(--muted);
}

.home-aside {
  margin-top: var(--space-xl);
  padding: var(--space-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.home-aside__title {
  font-size: 1rem;
}

.home-aside__list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: var(--space-md);
}

.home-aside__list li {
  font-size: 0.9375rem;
  color: var(--muted);
}

/* Auth */
.auth-page {
  display: flex;
  justify-content: center;
}

.auth-panel {
  width: 100%;
  max-width: 26rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-xl) var(--space-lg);
  box-shadow: var(--shadow-soft);
}

.auth-panel__title {
  font-size: 1.375rem;
}

.auth-panel__lead {
  color: var(--muted);
  font-size: 0.9375rem;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-xs);
  margin: var(--space-lg) 0;
  padding: var(--space-xs);
  background: var(--surface-soft);
  border-radius: var(--radius);
}

.auth-tabs__btn {
  border: none;
  background: transparent;
  padding: 0.5rem;
  border-radius: calc(var(--radius) - 2px);
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}

.auth-tabs__btn--active {
  background: var(--surface);
  color: var(--accent);
  box-shadow: var(--shadow-soft);
}

.field {
  margin-bottom: var(--space-md);
}

.field label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: var(--space-xs);
}

.field input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.55rem 0.75rem;
  background: var(--bg);
}

.field input:focus {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
}

.form-message {
  font-size: 0.875rem;
  margin-bottom: var(--space-md);
}

.form-message--error {
  color: var(--danger);
}

.form-message--ok {
  color: var(--accent);
}

.auth-footnote {
  text-align: center;
  font-size: 0.8125rem;
  color: var(--muted);
  margin: var(--space-md) 0;
}

.auth-form .btn {
  margin-bottom: var(--space-sm);
}

/* Library */
.page-header__title {
  font-size: clamp(1.375rem, 3.5vw, 1.75rem);
}

.page-header__lead {
  color: var(--muted);
  font-size: 1.0625rem;
}

.library-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  align-items: center;
  margin: var(--space-lg) 0;
}

.library-search {
  display: flex;
  flex: 1 1 14rem;
  gap: var(--space-sm);
  min-width: 0;
}

.library-search__input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.55rem 0.75rem;
  background: var(--surface);
}

.filter-section {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-lg);
  margin-bottom: var(--space-lg);
}

.filter-section__title {
  font-size: 1rem;
  margin-bottom: var(--space-md);
}

.filter-group + .filter-group {
  margin-top: var(--space-md);
}

.filter-group__label {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--muted);
  margin: 0 0 var(--space-xs);
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
}

.chip {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--fg);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
}

.chip--active {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-fg);
}

.chip--brow.chip--active {
  border-color: var(--brow);
  background: var(--brow);
  color: var(--surface);
}

.chip--nail.chip--active {
  border-color: var(--nail);
  background: var(--nail);
  color: var(--surface);
}

.info-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--space-md);
}

.info-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-lg);
  box-shadow: var(--shadow-soft);
}

.info-card__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
}

.info-card__topic {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--muted);
}

.info-card__title {
  font-size: 1.125rem;
}

.info-card__summary {
  color: var(--muted);
  font-size: 0.9375rem;
}

.info-card__link {
  margin-top: var(--space-sm);
}

.state {
  text-align: center;
  padding: var(--space-xl);
  color: var(--muted);
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

@media (max-width: 720px) {
  .site-header__inner {
    flex-direction: column;
    align-items: stretch;
  }

  .site-brand {
    margin-right: 0;
  }

  .site-search {
    max-width: none;
  }
}
