@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600&family=Noto+Serif+JP:wght@500;700&display=swap');

:root {
  --ink: #22201d;
  --paper: #f5f0e7;
  --paper-light: #fbf8f2;
  --red: #b83a32;
  --red-dark: #8c2924;
  --sage: #526358;
  --line: #d9d0c2;
  --muted: #756e66;
  --shadow: 0 18px 50px rgba(58, 45, 34, .09);
  --serif: "Noto Serif JP", Georgia, serif;
  --sans: "DM Sans", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--paper); font-family: var(--sans); line-height: 1.65; }
body::before { content: ""; position: fixed; inset: 0; pointer-events: none; opacity: .2; z-index: -1; background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 120 120' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.12'/%3E%3C/svg%3E"); }
a { color: inherit; }
button, input, textarea { font: inherit; }
img, video { max-width: 100%; display: block; }
.site-header { width: min(1180px, calc(100% - 40px)); height: 88px; margin: auto; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; font-family: var(--serif); font-weight: 700; letter-spacing: .02em; }
.brand-mark { width: 28px; height: 28px; display: inline-block; border-radius: 50%; background: var(--red); box-shadow: inset -6px -2px 0 rgba(255,255,255,.12); }
nav { display: flex; align-items: center; gap: 26px; }
nav a, .nav-button { background: none; border: 0; color: var(--muted); font-size: .88rem; text-decoration: none; cursor: pointer; padding: 8px 0; }
nav a:hover, .nav-button:hover { color: var(--red); }
.inline-form { display: inline; margin: 0; }
main { min-height: calc(100vh - 170px); }
.hero { width: min(1180px, calc(100% - 40px)); min-height: 570px; margin: auto; display: grid; grid-template-columns: 1.05fr .95fr; align-items: center; gap: 50px; overflow: hidden; }
.eyebrow { color: var(--red); font-size: .74rem; font-weight: 600; letter-spacing: .2em; text-transform: uppercase; }
.hero h1 { margin: 15px 0 25px; font: 700 clamp(3.7rem, 8vw, 7.4rem)/.98 var(--serif); letter-spacing: -.045em; }
.hero h1 em { color: var(--red); font-style: normal; }
.intro { color: var(--muted); max-width: 520px; font-size: 1.08rem; }
.sun-scene { height: 420px; position: relative; }
.sun { position: absolute; width: 280px; height: 280px; background: var(--red); border-radius: 50%; top: 22px; right: 80px; }
.mountain { position: absolute; bottom: 50px; width: 440px; height: 220px; clip-path: polygon(0 100%, 52% 0, 100% 100%); }
.mountain-back { right: -30px; background: #9ca79e; opacity: .55; }
.mountain-front { right: 100px; background: var(--sage); }
.mountain-front::after { content: ""; position: absolute; inset: 0; background: var(--paper-light); clip-path: polygon(52% 0, 36% 31%, 47% 25%, 53% 38%, 60% 26%, 68% 34%); }
.journal { background: var(--paper-light); border-top: 1px solid var(--line); padding: 100px max(20px, calc((100% - 980px)/2)) 120px; }
.section-heading { margin-bottom: 55px; }
.section-heading h2 { font: 700 clamp(2.1rem, 5vw, 3.4rem)/1.2 var(--serif); margin: 5px 0; }
.post-list { display: grid; gap: 80px; }
.post-card { border-top: 1px solid var(--line); padding-top: 32px; }
.post-header { display: grid; grid-template-columns: 70px 1fr; gap: 20px; margin-bottom: 30px; }
.post-number { color: var(--red); font-family: var(--serif); font-size: 1.2rem; margin: 5px 0; }
.post-header time, .admin-posts time { color: var(--muted); font-size: .78rem; letter-spacing: .06em; text-transform: uppercase; }
.post-header h3 { font: 700 clamp(1.8rem, 4vw, 3rem)/1.25 var(--serif); margin: 5px 0; }
.post-body { margin-left: 90px; max-width: 760px; font-size: 1.05rem; color: #48433d; }
.media-grid { margin: 40px 0 0 90px; display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.media-grid figure { margin: 0; background: #ded8cf; overflow: hidden; aspect-ratio: 4/3; }
.media-grid img, .media-grid video { width: 100%; height: 100%; object-fit: cover; }
.media-item { position: relative; }
.media-open { appearance: none; display: block; width: 100%; height: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; }
.media-open img { transition: transform .35s ease, filter .35s ease; }
.media-open:hover img, .media-open:focus-visible img { transform: scale(1.025); filter: brightness(.86); }
.expand-icon { position: absolute; top: 14px; right: 14px; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; color: white; background: rgba(25, 23, 21, .72); font-size: 1.15rem; opacity: 0; transform: translateY(5px); transition: .2s ease; }
.media-open:hover .expand-icon, .media-open:focus-visible .expand-icon { opacity: 1; transform: translateY(0); }
.video-open { position: absolute; inset: 0; width: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 9px; border: 0; color: white; background: rgba(20, 20, 18, .22); cursor: zoom-in; font-weight: 600; text-shadow: 0 1px 8px #000; }
.video-open:hover, .video-open:focus-visible { background: rgba(20, 20, 18, .4); }
.play-icon { width: 58px; height: 58px; display: grid; place-items: center; padding-left: 4px; border-radius: 50%; background: rgba(184, 58, 50, .92); font-size: 1.25rem; text-shadow: none; box-shadow: 0 8px 25px rgba(0, 0, 0, .25); }
.media-single { grid-template-columns: 1fr; }
.media-single figure { aspect-ratio: 16/9; }
.lightbox { width: min(94vw, 1400px); max-width: none; height: min(92vh, 950px); max-height: none; padding: 54px 24px 20px; border: 0; color: white; background: rgba(16, 15, 14, .97); box-shadow: 0 30px 100px rgba(0, 0, 0, .55); }
.lightbox::backdrop { background: rgba(18, 16, 14, .78); backdrop-filter: blur(8px); }
.lightbox-content { height: calc(100% - 38px); display: grid; place-items: center; }
.lightbox-content img, .lightbox-content video { width: auto; height: auto; max-width: 100%; max-height: 100%; object-fit: contain; }
.lightbox-close { position: absolute; z-index: 2; top: 9px; right: 14px; width: 42px; height: 42px; padding: 0; border: 0; color: white; background: transparent; cursor: pointer; font: 300 2.1rem/1 var(--sans); }
.lightbox-close:hover { color: #e16b63; }
.lightbox-caption { height: 30px; margin: 8px 0 0; overflow: hidden; color: #d6d0c7; text-align: center; font-size: .8rem; }
.empty-state { text-align: center; padding: 70px 20px; border: 1px solid var(--line); }
.empty-symbol { display: block; color: var(--red); font: 700 3rem var(--serif); }
.empty-state h3 { font: 700 1.6rem var(--serif); margin: 12px 0 0; }
.site-footer { min-height: 90px; display: grid; place-items: center; color: var(--muted); font-size: .8rem; letter-spacing: .05em; }
.button { appearance: none; display: inline-flex; justify-content: center; border: 0; background: var(--red); color: white; padding: 13px 24px; text-decoration: none; cursor: pointer; font-weight: 600; transition: .2s; }
.button:hover { background: var(--red-dark); transform: translateY(-1px); }
.button-wide { width: 100%; padding: 16px 24px; }
.flash { width: min(1180px, calc(100% - 40px)); margin: 20px auto 0; padding: 13px 18px; border-left: 4px solid; background: white; box-shadow: var(--shadow); }
.flash-success { border-color: #52745e; }.flash-error { border-color: var(--red); }
.auth-shell { width: min(1000px, calc(100% - 40px)); min-height: 650px; margin: auto; display: grid; grid-template-columns: 1fr 430px; gap: 80px; align-items: center; }
.auth-aside h1, .admin-hero h1 { font: 700 clamp(2.8rem, 6vw, 5rem)/1.08 var(--serif); margin: 12px 0; }
.auth-aside > p:last-child, .admin-hero > div > p:last-child { color: var(--muted); }
.auth-card, .editor-panel, .entries-panel { background: var(--paper-light); border: 1px solid var(--line); box-shadow: var(--shadow); }
.auth-card { padding: 42px; }
.auth-card h2 { font: 700 1.5rem var(--serif); margin: 0 0 28px; }
.stacked-form, .editor-form { display: grid; gap: 20px; }
.stacked-form label, .editor-form > label { display: grid; gap: 7px; font-size: .8rem; font-weight: 600; letter-spacing: .03em; }
input, textarea { width: 100%; border: 1px solid var(--line); color: var(--ink); background: white; padding: 12px 14px; border-radius: 0; outline: none; }
input:focus, textarea:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(184,58,50,.1); }
textarea { resize: vertical; line-height: 1.65; }
.field-hint { color: var(--muted); font-size: .75rem; margin: -10px 0 0; }
.form-error { background: #f8e7e4; color: #79251f; padding: 12px; margin-bottom: 20px; font-size: .85rem; }
.admin-hero { width: min(1180px, calc(100% - 40px)); margin: 75px auto 55px; display: flex; align-items: end; justify-content: space-between; }
.admin-hero h1 { font-size: clamp(2.4rem, 5vw, 4rem); }
.text-link { color: var(--red); text-decoration: none; padding-bottom: 12px; }
.admin-grid { width: min(1180px, calc(100% - 40px)); margin: 0 auto 100px; display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(320px, .65fr); align-items: start; gap: 28px; }
.panel-heading { padding: 17px 24px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; font: 600 .8rem var(--sans); letter-spacing: .08em; text-transform: uppercase; }
.panel-heading a { color: var(--red); text-transform: none; letter-spacing: 0; }
.panel-heading b { background: var(--red); color: #fff; border-radius: 20px; min-width: 24px; height: 24px; text-align: center; line-height: 24px; }
.editor-form { padding: 28px; }
.upload-zone { min-height: 145px; place-items: center; align-content: center; border: 1px dashed #b9aea0; background: #f8f4ed; color: var(--muted); cursor: pointer; text-align: center; }
.upload-zone:hover { border-color: var(--red); }
.upload-zone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.upload-icon { color: var(--red); font-size: 1.8rem; line-height: 1; }
.upload-zone strong { color: var(--ink); font-size: .9rem; }
.file-selection { color: var(--sage); font-size: .78rem; overflow-wrap: anywhere; }
.existing-media { border: 1px solid var(--line); margin: 0; padding: 15px; }
.existing-media legend { color: var(--muted); font-size: .8rem; }
.media-check-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.media-check { display: grid; gap: 5px; font-size: .72rem; color: var(--red); }
.media-check img, .video-placeholder { width: 100%; aspect-ratio: 4/3; object-fit: cover; background: #333; color: white; display: grid; place-items: center; }
.media-check input { width: auto; }
.admin-posts article { padding: 22px 24px; border-bottom: 1px solid var(--line); }
.admin-posts article:last-child { border-bottom: 0; }
.admin-posts h3 { font: 700 1.1rem/1.4 var(--serif); margin: 5px 0; }
.admin-posts p { color: var(--muted); font-size: .72rem; margin: 0 0 12px; }
.row-actions { display: flex; gap: 16px; }
.row-actions a, .row-actions button { color: var(--red); border: 0; background: none; padding: 0; cursor: pointer; font-size: .78rem; text-decoration: underline; }
.muted-box { color: var(--muted); padding: 25px; font-size: .85rem; }

@media (max-width: 800px) {
  .site-header { height: 72px; }.site-header nav { gap: 14px; }.site-header nav a:first-child { display: none; }
  .hero { grid-template-columns: 1fr; min-height: 650px; padding-top: 60px; }.sun-scene { height: 270px; }.sun { width: 200px; height: 200px; right: 10%; }.mountain { width: 330px; height: 170px; bottom: 0; }.mountain-front { right: 12%; }.mountain-back { right: -20%; }
  .journal { padding-top: 70px; }.post-header { grid-template-columns: 40px 1fr; }.post-body, .media-grid { margin-left: 60px; }
  .auth-shell { grid-template-columns: 1fr; gap: 25px; padding: 60px 0; }.auth-card { padding: 28px; }
  .admin-hero { margin-top: 55px; align-items: start; }.admin-grid { grid-template-columns: 1fr; }.entries-panel { order: -1; }
}
@media (max-width: 520px) {
  .brand { font-size: .9rem; }.brand-mark { width: 22px; height: 22px; }nav { gap: 10px; }nav a, .nav-button { font-size: .76rem; }
  .hero h1 { font-size: 3.6rem; }.post-header { grid-template-columns: 1fr; gap: 0; }.post-number { margin-bottom: 0; }.post-body, .media-grid { margin-left: 0; }.media-grid { grid-template-columns: 1fr; }
  .admin-hero { display: block; }.editor-form { padding: 20px; }.media-check-grid { grid-template-columns: repeat(2, 1fr); }
}
