/* Journal, Mig & Skat */
:root {
  --bg: #fdf9f5;
  --bg-card: #ffffff;
  --ink: #2b1f2a;
  --muted: #2b1f2a;
  --accent: #a35f7b;
  --accent-soft: #e6bfd0;
  --line: #efdeea;
  --serif: "Crafty Girls", "Comic Sans MS", cursive;
  --sans: "Crafty Girls", "Comic Sans MS", cursive;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 1.05rem;
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 120% 80% at 50% -20%, rgba(230, 191, 208, 0.25), transparent),
    radial-gradient(ellipse 80% 50% at 100% 50%, rgba(163, 95, 123, 0.1), transparent);
}

body[data-current]:not([data-current="home"]):not([data-current="login"]) {
  visibility: hidden;
}

html.auth-gate-ok body[data-current]:not([data-current="home"]):not([data-current="login"]) {
  visibility: visible;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--ink);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(253, 249, 245, 0.93);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  max-width: 72rem;
  margin: 0 auto;
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  position: relative;
  overflow: visible;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
}

.logo {
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: 0.02em;
}

.logo:hover {
  color: var(--accent);
}

.nav-toggle {
  display: block;
  font-family: var(--sans);
  font-size: 0.9rem;
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-card);
  cursor: pointer;
  color: var(--ink);
}

.nav-links {
  display: none;
  flex-direction: column;
  gap: 0.25rem;
  list-style: none;
  margin: 0;
  padding: 0.5rem;
  position: static;
  width: min(22rem, calc(100vw - 2.5rem));
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg-card);
  box-shadow: 0 14px 30px rgba(30, 15, 34, 0.12);
  z-index: 200;
}

#site-nav {
  position: fixed;
  top: 4.3rem;
  right: 1rem;
  z-index: 1400;
}

.nav-links a {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  border-radius: 8px;
  padding: 0.25rem 0.4rem;
  transition: background-color 0.14s ease, color 0.14s ease;
}

.nav-links a:hover {
  color: var(--accent);
  background: rgba(230, 191, 208, 0.2);
}

.nav-links a[aria-current="page"] {
  color: var(--accent);
  font-weight: 600;
}

.top-auth-link {
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--accent);
  border: 1px solid #dfb7c8;
  background: var(--bg-card);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  box-shadow: 0 1px 4px rgba(163, 95, 123, 0.12);
}

.top-auth-link:hover {
  border-color: var(--accent-soft);
}

.theme-toggle,
.edit-toggle {
  font-family: var(--sans);
  font-size: 0.88rem;
  font-weight: 600;
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-card);
  color: var(--accent);
  cursor: pointer;
}

.theme-toggle:hover,
.edit-toggle:hover {
  border-color: var(--accent-soft);
}

.nav-links.is-open {
  display: flex;
}

@media (max-width: 560px) {
  #site-nav {
    right: 0.5rem;
    left: 0.5rem;
  }
  .nav-links {
    width: 100%;
  }
}

main {
  max-width: 42rem;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}

main.main-wide {
  max-width: 72rem;
}

.hero {
  text-align: center;
  padding: 2.5rem 0 2rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 2rem;
  position: relative;
}

.hero::after {
  content: "♡ ♡ ♡";
  display: block;
  margin-top: 0.75rem;
  color: var(--accent-soft);
  letter-spacing: 0.2rem;
  font-size: 0.9rem;
}

.hero-ornament {
  font-size: 1rem;
  letter-spacing: 0.15em;
  color: var(--accent-soft);
  margin-bottom: 0.75rem;
}

.hero h1 {
  font-family: var(--serif);
  font-size: clamp(2.2rem, 6vw, 3.25rem);
  font-weight: 600;
  line-height: 1.15;
  margin: 0 0 0.5rem;
  letter-spacing: -0.02em;
}

.hero-sub {
  font-size: 1.5rem;
  line-height: 1.4;
  margin: 0;
  color: var(--ink);
  opacity: 1;
  text-shadow: 0 1px 8px rgba(255, 255, 255, 0.5);
}

.hero-lead {
  max-width: 28rem;
  margin: 1.5rem auto 0;
  color: var(--ink);
  font-size: 1.05rem;
  text-shadow: 0 1px 8px rgba(255, 255, 255, 0.55);
}

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

.home-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
  max-width: 22rem;
  margin: 1.75rem auto 0;
  padding: 0 0.25rem 0.5rem;
}

@media (min-width: 400px) {
  .home-grid {
    max-width: 26rem;
    gap: 0.75rem;
  }
}

@media (min-width: 560px) {
  .home-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    max-width: 36rem;
    gap: 0.8rem;
  }
}

@media (min-width: 720px) {
  .home-grid {
    max-width: 40rem;
  }
}

.home-grid a.home-box {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: 0.65rem 0.4rem;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 10px;
  text-decoration: none !important;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 0.9rem;
  font-weight: 600;
  text-align: center;
  line-height: 1.2;
  box-shadow: 0 1px 3px rgba(31, 26, 23, 0.06);
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    background-color 0.15s ease,
    color 0.15s ease,
    transform 0.12s ease;
}

.home-grid a.home-box:hover,
.home-grid a.home-box:focus-visible {
  border-color: var(--accent-soft);
  color: var(--accent);
  background: #fffdfb;
  box-shadow: 0 4px 14px rgba(139, 90, 74, 0.1);
  transform: translateY(-1px);
  outline: none;
}

.home-grid a.home-box:focus-visible {
  box-shadow: 0 0 0 3px rgba(201, 160, 144, 0.4);
}

.page-title {
  font-family: var(--serif);
  font-size: 1.85rem;
  font-weight: 600;
  margin: 0 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--line);
  color: var(--ink);
}

section {
  margin-bottom: 2.5rem;
  scroll-margin-top: 4rem;
}

section:last-child {
  margin-bottom: 0;
}

section .page-title {
  margin-bottom: 1rem;
}

section h3 {
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 600;
  margin: 1.75rem 0 0.75rem;
  color: var(--accent);
}

section h4 {
  font-size: 0.95rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 1.25rem 0 0.5rem;
}

body.page-art main {
  max-width: none;
  min-height: calc(100vh - 9rem);
  padding-top: 1rem;
  padding-bottom: 2rem;
}

body.page-art .ascii-art {
  margin: 0 auto;
  max-width: 100%;
}

.art-gallery {
  width: min(72rem, 100%);
  margin: 0 auto 1.5rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}

.art-piece {
  margin: 0;
  padding: 0.65rem;
}

.art-piece img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 8px;
  border: 1px solid var(--line);
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
  box-shadow: 0 10px 24px rgba(163, 95, 123, 0.06);
}

ul.clean {
  margin: 0;
  padding-left: 1.25rem;
}

ul.clean li {
  margin-bottom: 0.35rem;
}

.travel-block {
  margin-bottom: 1.5rem;
}

.travel-block h4 {
  margin-top: 0;
}

.watch-grid {
  display: grid;
  gap: 1rem;
}

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

.ascii-art {
  font-family: "Consolas", "Courier New", monospace;
  font-size: 0.45rem;
  line-height: 1.05;
  overflow-x: auto;
  margin: 1rem 0;
  padding: 1rem;
  background: #f3f0eb;
  border-radius: 8px;
  border: 1px solid var(--line);
  color: var(--ink);
  white-space: pre;
}

@media (min-width: 640px) {
  .ascii-art {
    font-size: 0.55rem;
  }
}

@media (min-width: 900px) {
  body.page-art .ascii-art {
    font-size: 0.62rem;
  }
}

details.accordion {
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-bottom: 0.65rem;
  background: var(--bg-card);
  overflow: hidden;
}

details.accordion summary {
  padding: 0.85rem 1rem;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

details.accordion summary::-webkit-details-marker {
  display: none;
}

details.accordion summary::after {
  content: "+";
  font-size: 1.1rem;
  color: var(--accent);
  font-weight: 400;
}

details.accordion[open] summary::after {
  content: "−";
}

details.accordion .accordion-body {
  padding: 0 1rem 1rem;
  color: var(--muted);
  font-size: 0.98rem;
}

details.accordion .accordion-body ul {
  margin: 0.5rem 0 0;
  padding-left: 1.2rem;
}

.note-box {
  border-left: 3px solid var(--accent-soft);
  padding: 0.75rem 1rem;
  margin: 1rem 0;
  background: rgba(201, 160, 144, 0.1);
  border-radius: 0 8px 8px 0;
  font-size: 0.95rem;
}

table.costs {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  margin: 1rem 0;
}

table.costs th,
table.costs td {
  text-align: left;
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--line);
}

table.costs th {
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

table.costs tr:last-child td {
  border-bottom: none;
}

.top5-grid {
  display: grid;
  gap: 1.5rem;
}

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

.person-tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  margin-bottom: 0.75rem;
}

.person-tag.nana {
  background: rgba(201, 160, 144, 0.25);
  color: #6b4538;
}

.person-tag.malthe {
  background: rgba(100, 120, 140, 0.2);
  color: #3d4f5c;
}

.favorites-section .section-intro {
  color: var(--muted);
  margin: 0 0 1.5rem;
  font-size: 1rem;
}

.cta-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.5rem;
  font-weight: 500;
}

.site-footer {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--muted);
  font-size: 0.9rem;
  border-top: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0), rgba(230, 191, 208, 0.1));
}

.site-footer .footer-brand {
  font-family: var(--serif);
}

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

.page-intro {
  margin-top: 0;
  color: var(--muted);
}

.gallery-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  margin-bottom: 1.25rem;
  padding: 1rem 1.25rem;
}

.gallery-upload {
  margin-bottom: 1rem;
}

.gallery-upload-label {
  display: inline-block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  font-size: 0.95rem;
}

.gallery-upload-input {
  display: block;
  width: 100%;
  max-width: 28rem;
  font-family: var(--sans);
  font-size: 0.95rem;
  color: var(--ink);
}

.gallery-upload-status {
  margin: 0.6rem 0 0;
  font-size: 0.88rem;
}

.gallery-sort-label {
  font-weight: 600;
  font-size: 0.95rem;
}

.gallery-sort-select {
  font-family: var(--sans);
  font-size: 0.95rem;
  padding: 0.45rem 2rem 0.45rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-card);
  color: var(--ink);
  cursor: pointer;
}

.gallery-toolbar-hint {
  width: 100%;
  margin: 0;
  font-size: 0.88rem;
}

.photo-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}

.photo-gallery-item {
  margin: 0;
  padding: 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.photo-gallery-thumb {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  margin: 0;
  border: none;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  background: var(--bg);
  font: inherit;
  line-height: 0;
}

.photo-gallery-thumb:focus-visible {
  outline: 2px solid var(--accent-soft);
  outline-offset: 3px;
}

.photo-gallery-thumb img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 8px;
  border: 1px solid var(--line);
  transition: transform 0.15s ease;
}

.photo-gallery-thumb:hover img {
  transform: scale(1.02);
}

.photo-gallery-visits {
  position: absolute;
  bottom: 0.5rem;
  right: 0.5rem;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ink);
  background: rgba(250, 247, 242, 0.92);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(31, 26, 23, 0.08);
}

.photo-gallery-caption {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--muted);
  text-align: center;
}

.photo-gallery-meta {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
  text-align: center;
}

.photo-delete-btn {
  align-self: center;
  margin-top: 0.1rem;
  padding: 0.35rem 0.75rem;
  font-family: var(--sans);
  font-size: 0.8rem;
  font-weight: 600;
  border: 1px solid #d8b8ad;
  border-radius: 8px;
  background: #fff6f3;
  color: #7a4334;
  cursor: pointer;
}

.photo-delete-btn:hover {
  border-color: #c18974;
  color: #5f2f22;
}

.gallery-auth-panel {
  margin-bottom: 1rem;
  padding: 0.85rem 1.25rem;
}

.gallery-auth-text {
  margin: 0;
  font-size: 0.95rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
}

.gallery-logout-btn {
  font-family: var(--sans);
  font-size: 0.88rem;
  font-weight: 600;
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-card);
  color: var(--accent);
  cursor: pointer;
}

.gallery-logout-btn:hover {
  border-color: var(--accent-soft);
  color: var(--ink);
}

.gallery-activity-section {
  margin-top: 2rem;
  padding: 1rem 1.25rem 1.25rem;
}

.gallery-activity-title {
  font-family: var(--serif);
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0 0 0.35rem;
  color: var(--ink);
}

.gallery-activity-intro {
  margin: 0 0 0.75rem;
  font-size: 0.9rem;
}

.gallery-activity-list {
  margin: 0;
  padding-left: 1.2rem;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.gallery-activity-item {
  margin-bottom: 0.35rem;
}

.login-form {
  max-width: 22rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.login-label {
  font-weight: 600;
  font-size: 0.92rem;
}

.login-input {
  width: 100%;
  font-family: var(--sans);
  font-size: 1rem;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-card);
  color: var(--ink);
}

.login-submit {
  margin-top: 0.25rem;
  font-family: var(--sans);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.55rem 1rem;
  border: 1px solid #b97692;
  border-radius: 999px;
  background: linear-gradient(180deg, #b97692 0%, #a35f7b 100%);
  color: #fffdfb;
  cursor: pointer;
  box-shadow: 0 6px 14px rgba(163, 95, 123, 0.22);
  transition: filter 0.14s ease, transform 0.14s ease;
}

.login-submit:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
}

.login-error {
  margin: 0;
  font-size: 0.9rem;
  color: #6b4538;
}

.blog-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.blog-input,
.blog-textarea {
  width: 100%;
  font-family: var(--sans);
  font-size: 1rem;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-card);
  color: var(--ink);
}

.blog-textarea {
  min-height: 8rem;
  resize: vertical;
}

.blog-submit {
  align-self: flex-start;
  font-family: var(--sans);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.55rem 1rem;
  border: 1px solid #b97692;
  border-radius: 999px;
  background: linear-gradient(180deg, #b97692 0%, #a35f7b 100%);
  color: #fffdfb;
  cursor: pointer;
  box-shadow: 0 6px 14px rgba(163, 95, 123, 0.22);
}

.blog-meta {
  margin: 0.25rem 0 0;
  font-size: 0.86rem;
  color: var(--muted);
}

.blog-delete-btn {
  margin-top: 0.75rem;
  padding: 0.35rem 0.75rem;
  font-family: var(--sans);
  font-size: 0.82rem;
  font-weight: 600;
  border: 1px solid #d8b8ad;
  border-radius: 8px;
  background: #fff6f3;
  color: #7a4334;
  cursor: pointer;
}

main.is-editing {
  outline: 2px dashed var(--accent-soft);
  outline-offset: 8px;
}

html[data-theme="dark"] {
  --bg: #151223;
  --bg-card: #231b33;
  --ink: #f8ecff;
  --muted: #f8ecff;
  --accent: #f1b6ff;
  --accent-soft: #8f7bd3;
  --line: #43335e;
}

html[data-theme="dark"] body {
  background-image:
    radial-gradient(circle at 10% 20%, rgba(255, 255, 255, 0.22) 1px, transparent 2px),
    radial-gradient(circle at 65% 35%, rgba(255, 255, 255, 0.18) 1px, transparent 2px),
    radial-gradient(circle at 35% 70%, rgba(255, 255, 255, 0.16) 1px, transparent 2px),
    linear-gradient(180deg, #1b1530 0%, #0f0c1d 100%);
  background-size: 210px 210px, 260px 260px, 300px 300px, cover;
}

html[data-theme="dark"] body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0) 40%, rgba(255, 255, 255, 0.35) 50%, rgba(255, 255, 255, 0) 60%) no-repeat;
  background-size: 180px 2px;
  animation: shootingStar 8s linear infinite;
  opacity: 0.75;
  z-index: 0;
}

html[data-theme="dark"] body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle at 15% 25%, rgba(255, 255, 255, 0.75) 0.9px, transparent 1.8px),
    radial-gradient(circle at 72% 18%, rgba(255, 255, 255, 0.58) 1px, transparent 2px),
    radial-gradient(circle at 46% 62%, rgba(255, 255, 255, 0.66) 0.9px, transparent 1.8px),
    radial-gradient(circle at 86% 73%, rgba(255, 255, 255, 0.5) 1px, transparent 2px),
    radial-gradient(circle at 30% 82%, rgba(255, 255, 255, 0.62) 0.9px, transparent 1.8px);
  animation: twinkle 4.6s ease-in-out infinite alternate;
  opacity: 0.75;
  z-index: 0;
}

html[data-theme="light"] body {
  background-image: url("./backgroundlightmode.png");
  background-position: center center;
  background-size: cover;
  background-repeat: no-repeat;
  background-attachment: fixed;
}

html[data-theme="light"] body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(253, 249, 245, 0.34), rgba(253, 249, 245, 0.18));
  opacity: 1;
  z-index: 0;
}

html[data-theme="light"] body::after {
  content: "";
  position: fixed;
  inset: auto 0 0 0;
  height: min(15vh, 120px);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0), rgba(249, 221, 235, 0.46));
  pointer-events: none;
  z-index: 0;
}

main,
.site-footer {
  position: relative;
  z-index: 1;
}

.site-header {
  position: sticky;
  z-index: 5000;
}

#site-nav {
  z-index: 6000;
}

.nav-links {
  position: relative;
  z-index: 6001;
}

@keyframes shootingStar {
  0% {
    transform: translate(-20vw, -10vh) rotate(-18deg);
    opacity: 0;
  }
  8% {
    opacity: 0.8;
  }
  22% {
    transform: translate(85vw, 65vh) rotate(-18deg);
    opacity: 0;
  }
  100% {
    transform: translate(85vw, 65vh) rotate(-18deg);
    opacity: 0;
  }
}

@keyframes twinkle {
  from {
    opacity: 0.35;
    filter: drop-shadow(0 0 1px rgba(255, 255, 255, 0.4));
  }
  to {
    opacity: 0.88;
    filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.85));
  }
}

/* Performance fallback: reduce expensive effects on constrained devices */
@media (max-width: 768px) {
  .site-header {
    backdrop-filter: none;
  }

  html[data-theme="dark"] body::before,
  html[data-theme="dark"] body::after {
    animation: none;
    opacity: 0.38;
  }

  html[data-theme="light"] body {
    background-attachment: scroll;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  html[data-theme="dark"] body::before,
  html[data-theme="dark"] body::after {
    animation: none;
  }
}

/* Tablet adjustments (without affecting desktop) */
@media (max-width: 1024px) {
  .header-inner {
    padding: 0.65rem 0.85rem;
    gap: 0.5rem;
  }

  .logo {
    font-size: 1.15rem;
  }

  #site-nav {
    top: 3.9rem;
    right: 0.75rem;
    left: 0.75rem;
  }

  .nav-links {
    width: 100%;
    max-height: min(72vh, 32rem);
    overflow-y: auto;
    border-radius: 12px;
    padding: 0.6rem;
  }

  .nav-links a {
    display: block;
    padding: 0.55rem 0.65rem;
    font-size: 0.95rem;
  }

  main {
    padding: 1.4rem 0.9rem 3rem;
  }

  .card {
    padding: 1rem 1.05rem;
    border-radius: 14px;
  }

  .home-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    max-width: 100%;
    gap: 0.6rem;
    padding: 0;
  }

  .home-grid a.home-box {
    min-height: 3rem;
    font-size: 0.95rem;
    padding: 0.65rem 0.5rem;
  }

  .photo-gallery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
  }
}

/* Phone adjustments */
@media (max-width: 768px) {
  body {
    font-size: 1rem;
  }

  .header-actions {
    gap: 0.35rem;
  }

  .top-auth-link,
  .theme-toggle,
  .edit-toggle,
  .nav-toggle {
    padding: 0.35rem 0.55rem;
    font-size: 0.8rem;
  }

  .hero {
    padding: 1.6rem 0 1.3rem;
    margin-bottom: 1.3rem;
  }

  .hero h1 {
    font-size: clamp(1.8rem, 9vw, 2.4rem);
    line-height: 1.2;
  }

  .hero-sub {
    font-size: 1.2rem;
  }

  .hero-lead {
    font-size: 0.95rem;
    max-width: 24rem;
  }

  .home-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.55rem;
  }

  .home-grid a.home-box {
    min-height: 2.8rem;
    font-size: 0.88rem;
  }

  .page-title {
    font-size: 1.55rem;
    margin-bottom: 0.8rem;
  }

  .login-form,
  .blog-form {
    max-width: 100%;
    gap: 0.6rem;
  }

  .login-input,
  .blog-input,
  .blog-textarea,
  .gallery-sort-select {
    font-size: 1rem;
    min-height: 44px;
  }

  .login-submit,
  .blog-submit {
    width: 100%;
    min-height: 44px;
  }

  .photo-gallery-grid {
    grid-template-columns: 1fr;
    gap: 0.7rem;
  }

  .photo-gallery-item {
    padding: 0.5rem;
  }

  .ascii-art {
    font-size: 0.4rem;
    padding: 0.75rem;
  }
}
