:root,
html[data-theme="day"] {
  color-scheme: light;
  --paper: #f3eee6;
  --paper-2: #ebe4d9;
  --ink: #1c1612;
  --ink-soft: #5c534a;
  --accent: #802050;
  --line: #fff;
  --card: rgba(255, 255, 255, 0.55);
  --beta: #3d2a14;
  --beta-ink: #f8ead0;
  --stripe: rgba(0, 0, 0, 0.04);
  --badge: rgba(128, 32, 80, 0.08);
  --code-bg: rgba(0, 0, 0, 0.05);
  --page-art: url("/img/background-v1.jpg");
}

html[data-theme="night"] {
  color-scheme: dark;
  --paper: #2a2a2e;
  --paper-2: #35353b;
  --ink: #eceae4;
  --ink-soft: #a8a6a0;
  --accent: #e090b0;
  --line: rgba(255, 255, 255, 0.4);
  --card: rgba(255, 255, 255, 0.06);
  --beta: #1c1c20;
  --beta-ink: #f8ead0;
  --stripe: rgba(255, 255, 255, 0.04);
  --badge: rgba(224, 144, 176, 0.14);
  --code-bg: rgba(255, 255, 255, 0.08);
  --page-art: url("/img/background-night-v1.jpg");
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Nunito", system-ui, sans-serif;
  color: var(--ink);
  background-color: var(--paper);
  background-image: var(--page-art);
  background-repeat: repeat-y;
  background-position: top center;
  background-size: 100% auto;
  line-height: 1.55;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.beta-banner {
  background: var(--beta);
  color: var(--beta-ink);
  text-align: center;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 8px 12px;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 920px;
  margin: 0 auto;
  padding: 24px 20px 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  font-family: "Nunito", system-ui, sans-serif;
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--ink);
  text-decoration: none;
}

.brand-logo,
.hero-logo {
  filter:
    drop-shadow(0 0 8px rgba(255, 255, 255, 0.9))
    drop-shadow(0 0 22px rgba(255, 255, 255, 0.55));
}

html[data-theme="night"] .brand-logo,
html[data-theme="night"] .hero-logo {
  filter:
    drop-shadow(0 0 8px rgba(0, 0, 0, 0.9))
    drop-shadow(0 0 22px rgba(0, 0, 0, 0.55));
}

.brand-logo {
  height: 1.55em;
  width: auto;
  max-width: 100%;
  object-fit: contain;
}

.brand-logo-day {
  display: block;
}

.brand-logo-night {
  display: none;
}

html[data-theme="night"] .brand-logo-day {
  display: none;
}

html[data-theme="night"] .brand-logo-night {
  display: block;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 0.92rem;
  font-weight: 700;
}

.site-nav a {
  color: var(--ink-soft);
}

.footer-tools {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin: 0 0 16px;
}

.theme-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink-soft);
  cursor: pointer;
}

.theme-btn:hover,
.theme-btn:focus-visible {
  color: var(--ink);
  border-color: var(--ink-soft);
}

.theme-btn svg {
  display: block;
}

.theme-btn .theme-icon-sun {
  display: none;
}

html[data-theme="night"] .theme-btn .theme-icon-sun {
  display: block;
}

html[data-theme="night"] .theme-btn .theme-icon-moon {
  display: none;
}

.lang-switch {
  display: flex;
  gap: 4px;
}

.lang-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink-soft);
  font: inherit;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-decoration: none;
}

.lang-btn.is-on {
  background: var(--paper-2);
  color: var(--ink);
  border-color: var(--ink-soft);
}

.site-main {
  max-width: 920px;
  margin: 0 auto;
  padding: 28px 20px 64px;
}

.hero {
  padding: 24px 0 40px;
  text-align: center;
}

.hero-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.22em;
  margin: 0;
  font-family: "Nunito", system-ui, sans-serif;
  font-size: clamp(2.6rem, 10vw, 4.2rem);
  line-height: 0.95;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.hero-logo {
  width: min(100%, 42rem);
  height: auto;
}

.hero-logo-day {
  display: block;
}

.hero-logo-night {
  display: none;
}

html[data-theme="night"] .hero-logo-day {
  display: none;
}

html[data-theme="night"] .hero-logo-night {
  display: block;
}

.section-title {
  margin: 0 0 18px;
  font-size: 1.15rem;
  font-weight: 800;
}

.project-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 16px;
}

.project-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  backdrop-filter: blur(4px);
}

.project-shot-wrap {
  margin: 14px 0 0;
}

.project-shot-wrap a {
  display: block;
}

.project-shot {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper-2);
}

.project-card h3 {
  margin: 0;
  text-align: center;
}

.project-description {
  margin: 10px 0 0;
  color: var(--ink);
  line-height: 1.5;
}

html[data-theme="night"] .project-card,
html[data-theme="night"] .project-description {
  color: #fff;
}

.project-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.badge {
  flex-shrink: 0;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--badge);
  border-radius: 999px;
  padding: 3px 8px;
}

.badge-live {
  color: #2d6a3a;
  background: rgba(45, 106, 58, 0.1);
}

.doc-page,
.legal-page {
  max-width: 42rem;
}

.doc-page h1,
.legal-page h1 {
  margin: 0;
  font-family: "Nunito", system-ui, sans-serif;
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.doc-lead,
.legal-updated {
  color: var(--ink-soft);
}

.doc-block,
.legal-section {
  margin-top: 28px;
}

.doc-block h2,
.legal-section h2 {
  margin: 0 0 10px;
  font-size: 1.05rem;
}

.doc-project {
  margin-top: 18px;
}

.doc-project h3 {
  margin: 0 0 8px;
  font-size: 1rem;
  font-weight: 800;
}

.legal-breadcrumb {
  margin: 0 0 10px;
  font-size: 0.88rem;
  color: var(--ink-soft);
}

.guide-play {
  margin: 14px 0 0;
  font-weight: 800;
}

.legal-section .doc-list {
  margin: 8px 0 0;
}

.legal-section .doc-list li + li {
  margin-top: 6px;
}

.doc-list {
  margin: 0;
  padding-left: 1.2rem;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.9em;
  background: var(--code-bg);
  border-radius: 6px;
  padding: 2px 6px;
}

.site-footer {
  max-width: 920px;
  margin: 0 auto;
  padding: 0 20px 32px;
  color: var(--ink-soft);
  font-size: 0.88rem;
  text-align: center;
}

.site-footer-line {
  margin: 0;
  color: #fff;
}

.footer-sep {
  margin: 0 0.45em;
  color: rgba(255, 255, 255, 0.55);
}

.site-footer-line a {
  color: #fff;
  font-weight: 700;
  text-decoration: none;
}

.site-footer-line a:hover,
.site-footer-line a:focus-visible {
  color: #fff;
  text-decoration: underline;
}

.footer-icon {
  display: inline-flex;
  align-items: center;
  vertical-align: -0.15em;
}

.footer-icon svg {
  display: block;
}

.footer-icon:hover,
.footer-icon:focus-visible {
  text-decoration: none;
}

@media (min-width: 641px) {
  body:has(.hero) .site-header {
    display: none;
  }
}

@media (min-width: 720px) {
  .project-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1100px) {
  .site-header,
  .site-main,
  .site-footer {
    max-width: 1440px;
  }

  .project-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  }
}

@media (max-width: 640px) {
  .site-header {
    flex-wrap: nowrap;
    align-items: center;
    justify-content: center;
    gap: 12px;
  }

  .brand {
    font-size: 1.55rem;
  }

  .site-main {
    padding-top: 10px;
  }

  .hero {
    padding: 6px 0 24px;
    text-align: left;
  }

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

.footer-text-btn {
  appearance: none;
  border: 0;
  background: none;
  padding: 0;
  margin: 0;
  font: inherit;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
}

.footer-text-btn:hover,
.footer-text-btn:focus-visible {
  text-decoration: underline;
}

.cookie-modal {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(28, 22, 18, 0.45);
}

html[data-theme="night"] .cookie-modal {
  background: rgba(0, 0, 0, 0.55);
}

.cookie-modal.is-open {
  display: flex;
}

.cookie-modal-panel {
  width: min(420px, 100%);
  padding: 20px 18px 16px;
  background: var(--paper);
  color: var(--ink);
  border: 2px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.24);
}

.cookie-consent-title {
  margin: 0 0 8px;
  font-size: 1.05rem;
  font-weight: 800;
}

.cookie-consent-body {
  margin: 0 0 12px;
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--ink-soft, var(--muted, #5c534a));
}

.cookie-consent-body a,
.cookie-consent-privacy {
  appearance: none;
  border: 0;
  background: none;
  padding: 0;
  margin: 0;
  font: inherit;
  font-weight: 700;
  color: var(--accent, var(--ink, var(--text)));
  cursor: pointer;
  text-decoration: underline;
}

.cookie-consent-actions {
  display: flex;
  gap: 8px;
}

.cookie-consent-actions a,
.cookie-consent-actions button {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 42px;
  border-radius: 12px;
  font: inherit;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.cookie-consent-reject {
  background: var(--paper-2, var(--panel, #ebe4d9));
  color: var(--ink, var(--text));
  border: 2px solid var(--line);
}

.cookie-consent-accept {
  background: var(--fab-active, var(--btn-primary-bg, var(--accent, #1c1612)));
  color: var(--fab-active-text, var(--btn-primary-text, #fff));
  border: 2px solid transparent;
}

.footer-version {
  color: #fff;
}

#site-version-update[hidden] {
  display: none;
}

.app-update {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 210;
  width: min(420px, calc(100% - 24px));
  margin-inline: auto;
  padding: 16px 16px 14px;
  background: var(--paper);
  color: var(--ink);
  border: 2px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.24);
}

.app-update[hidden] {
  display: none !important;
}

.app-update-title {
  margin: 0 0 8px;
  font-size: 1.05rem;
  font-weight: 800;
}

.app-update-body {
  margin: 0 0 12px;
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--ink-soft);
}

.app-update-actions {
  display: flex;
  gap: 8px;
}

.app-update-reload {
  flex: 1;
  height: 42px;
  border-radius: 12px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  background: var(--fab-active, var(--btn-primary-bg, var(--accent, #1c1612)));
  color: var(--fab-active-text, var(--btn-primary-text, #fff));
  border: 2px solid transparent;
}
