:root {
  color-scheme: light;
  --paper: #f8f5ef;
  --surface: #fffdf8;
  --ink: #26352d;
  --muted: #56645a;
  --accent: #355746;
  --accent-hover: #284638;
  --sage: #e7ede2;
  --line: #d9ded4;
  --danger: #8c3128;
  --serif: "PT Serif", Georgia, serif;
  --shadow: 0 12px 36px #27392b10;
  font-family: Inter, "Segoe UI", sans-serif;
  font-size: 100%;
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 19rem; }
main { min-height: 55vh; }
h1, h2, h3, p, figure { margin: 0; }
button, input, textarea, select { font: inherit; }
img { display: block; max-width: 100%; }
a { color: var(--accent); text-underline-offset: .18em; }
:focus-visible { outline: 3px solid #527a63; outline-offset: 4px; }

.site-shell {
  width: min(100% - 4rem, 76rem);
  margin-inline: auto;
}

.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 4.5rem;
  gap: 1rem 2rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: .75rem;
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  flex: 0 0 auto;
  border-radius: .55rem;
  background: var(--accent);
  color: #fff;
  font-weight: 720;
  line-height: 1;
}

.site-nav, .header-actions, .form-actions, .hero-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .65rem 1rem;
}

.site-nav a, .site-nav button {
  padding: .4rem .25rem;
  border: 0;
  border-radius: .2rem;
  color: var(--muted);
  background: transparent;
  font-size: .875rem;
  font-weight: 590;
  text-decoration: none;
}

.site-nav :is(a, button):hover,
.site-nav [aria-current="page"] {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: .35em;
}

button, select, input[type="file"] { cursor: pointer; }

.button, button[type="submit"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  min-height: 2.75rem;
  padding: .58rem 1rem;
  border: 1px solid transparent;
  border-radius: .55rem;
  background: var(--accent);
  color: #fff;
  font-weight: 640;
  font-size: .9rem;
  text-align: center;
  text-decoration: none;
  line-height: 1.35;
}

.button:hover, button[type="submit"]:hover { background: var(--accent-hover); }
.button-secondary {
  border-color: var(--line);
  background: var(--surface);
  color: var(--accent);
}
.button-secondary:hover { background: var(--sage); }
.button-quiet {
  color: var(--accent);
  background: transparent;
  border-color: transparent;
}
.button-quiet:hover { background: var(--sage); }
.button-danger { border-color: #e5c6bf; background: #fff8f3; color: var(--danger); }
.button-danger:hover { background: #f6e0d9; }
button:disabled { opacity: .55; cursor: not-allowed; }

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.12fr);
  align-items: center;
  gap: clamp(1.2rem, 4vw, 4rem);
  padding-block: clamp(2.3rem, 6vw, 5.4rem);
  border-bottom: 1px solid var(--line);
}

.hero-copy { min-width: 0; }
.hero-copy > * + * { margin-top: 1.05rem; }
.hero-copy > p:not(.eyebrow) { color: var(--muted); max-width: 36rem; }
.eyebrow, .section-kicker {
  color: var(--accent);
  font-size: .76rem;
  font-weight: 680;
  letter-spacing: .1em;
  text-transform: uppercase;
}

h1, h2 { font-family: var(--serif); font-weight: 400; line-height: 1.12; text-wrap: balance; }
h1 { font-size: clamp(2.35rem, 5.1vw, 4.7rem); letter-spacing: -.055em; }
h2 { font-size: clamp(1.7rem, 3.2vw, 2.75rem); letter-spacing: -.035em; }

.hero-media {
  display: block;
  min-width: 0;
  overflow: hidden;
  border-radius: .9rem;
  background: #e5e9df;
  text-decoration: none;
}
.hero-media > img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.hero-media figcaption { padding: .55rem .8rem; font-size: .82rem; color: var(--muted); }

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  flex-wrap: wrap;
  gap: 1rem;
  margin-block: 2.4rem 1.25rem;
}
.section-head p, .section-note { margin-top: .35rem; color: var(--muted); }
.section-head + p { margin-bottom: 1rem; }

.project-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.25rem;
  padding: 0;
  margin: 0 0 2.8rem;
  list-style: none;
}

.project-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: .9rem;
  background: var(--surface);
  transition: box-shadow .18s ease, border-color .18s ease;
}
.project-card:hover, .project-card:focus-within { border-color: #a6b8a9; box-shadow: var(--shadow); }
.project-card a { color: inherit; text-decoration: none; }
.project-card a:hover .project-title, a.project-title:hover { text-decoration: underline; }

.project-cover, .cover-placeholder {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: #e7e9df;
}
.project-cover img, img.project-cover { width: 100%; height: 100%; object-fit: cover; }
.cover-placeholder { display: grid; place-items: center; color: var(--muted); font-size: .88rem; }
.project-body { display: grid; gap: .4rem; padding: .9rem 1rem 1rem; }
.project-title { font-size: clamp(1.08rem, 2.5vw, 1.4rem); font-weight: 650; overflow-wrap: anywhere; }
.project-author, .project-meta, .meta-line {
  color: var(--muted);
  font-size: .875rem;
  overflow-wrap: anywhere;
}
.project-meta, .meta-line { display: flex; flex-wrap: wrap; gap: .25rem .55rem; }
.project-meta > :not(:first-child)::before { content: "·"; margin-right: .45rem; color: #727e73; }
.status-badge {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  padding: .18rem .55rem;
  border-radius: 99rem;
  background: var(--sage);
  color: #365440;
  font-size: .75rem;
  font-weight: 650;
}
[data-status="draft"].status-badge { color: #635238; background: #f0e8d9; }

.panel, .empty-state, .notice, .auth-panel, .editor-panel {
  border: 1px solid var(--line);
  border-radius: .8rem;
  background: var(--surface);
}
.panel, .auth-panel, .editor-panel { padding: clamp(1rem, 3vw, 2rem); }
.panel > * + *, .auth-panel > * + *, .editor-panel > * + * { margin-top: 1rem; }
.auth-panel { width: min(100%, 33rem); margin: 3rem auto; }
.empty-state { padding: clamp(1.4rem, 5vw, 3.2rem); margin-block: 1rem 3rem; text-align: center; }
.empty-state > * + * { margin: .7rem auto 0; }
.empty-state p { max-width: 34rem; color: var(--muted); }
.notice { padding: .85rem 1rem; margin-block: 1rem; color: var(--muted); }
.notice[data-variant="error"], .notice.error {
  background: #fbefeb;
  border-color: #e3b9b1;
  color: var(--danger);
}
.notice[data-variant="success"] { background: var(--sage); border-color: #cad7ca; color: var(--accent); }

.field, form label:not(.checkbox) { display: grid; gap: .3rem; min-width: 0; }
form label { font-size: .92rem; font-weight: 620; }
form > * + *, .form-stack > * + * { margin-top: .95rem; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.field-wide { grid-column: 1 / -1; }
.field-hint, small { color: var(--muted); font-size: .8rem; font-weight: 400; }
input:not([type="checkbox"], [type="radio"]), textarea, select {
  width: 100%;
  min-height: 2.75rem;
  padding: .6rem .72rem;
  border: 1px solid #bcc8bc;
  border-radius: .5rem;
  background: #fffefa;
  color: var(--ink);
}
input::placeholder, textarea::placeholder { color: #6a746a; opacity: 1; }
textarea { min-height: 8rem; resize: vertical; }
input[aria-invalid="true"], textarea[aria-invalid="true"], select[aria-invalid="true"] {
  border-color: var(--danger);
}
input[type="file"]::file-selector-button {
  margin-inline-end: .55rem;
  padding: .35rem .6rem;
  border: 0;
  border-radius: .3rem;
  background: var(--sage);
  color: var(--accent);
}
.field-error, [role="alert"]:not(.notice) { color: var(--danger); }

.project-detail { margin-block: clamp(1.5rem, 5vw, 4rem); overflow-wrap: anywhere; }
.project-detail > * + * { margin-top: 1rem; }
.detail-cover { overflow: hidden; border-radius: .9rem; background: var(--sage); }
.detail-cover img, img.detail-cover {
  width: 100%;
  max-height: 48rem;
  object-fit: contain;
}
.detail-cover figcaption { padding: .5rem .8rem; color: var(--muted); }
.detail-data {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 9rem), 1fr));
  gap: .75rem 1rem;
  padding: 1rem;
  border-block: 1px solid var(--line);
}
.detail-data dt { color: var(--muted); font-size: .8rem; }
.detail-data dd { margin: .12rem 0 0; font-weight: 620; }
.project-description { max-width: 46rem; white-space: pre-wrap; }
.starter-project-card .project-body { display:flex; flex-direction:column; gap:.65rem }
.starter-project-card .starter-cover-link { display:block }
.starter-project-card .project-cover { aspect-ratio:16/11 }
.starter-description { color:var(--muted); font-size:.9rem; line-height:1.55 }
.starter-accuracy { color:var(--muted); font-size:.82rem; line-height:1.5; margin-top:auto }
.starter-accuracy summary { color:var(--accent); cursor:pointer; min-height:44px; display:flex; align-items:center; gap:.4rem; list-style:none }
.starter-accuracy summary::before { content:'+'; font-size:1.1rem }
.starter-accuracy[open] summary::before { content:'−' }
.starter-accuracy p { padding-bottom:.75rem }
.starter-project-card .button { align-self:start }
.detail-data { display:block }
.detail-data > * + * { margin-top:1rem }
.space-description { max-width:46rem; margin-bottom:1.5rem; color:var(--muted) }
.publication-scope { max-width:29rem }
.project-social { max-width:54rem; padding-block:1.5rem; border-top:1px solid var(--line) }
.project-social h2 { margin-block:1.1rem .7rem; font-family:var(--serif); font-size:1.7rem; font-weight:400 }
.reaction-controls { display:flex; flex-wrap:wrap; gap:.5rem }
.reaction-controls button[aria-pressed="true"] { background:var(--sage); border-color:var(--accent); color:var(--accent); font-weight:650 }
.comment-list { display:grid; gap:.85rem; margin-bottom:1rem }
.comment { border:1px solid var(--line); border-radius:.7rem; padding:1rem; background:var(--surface) }
.comment-header { display:flex; flex-wrap:wrap; gap:.4rem 1rem; align-items:center; margin-bottom:.55rem }
.comment-header time { color:var(--muted); font-size:.8rem }
.comment-header button { margin-left:auto; font-size:.8rem; min-height:2rem }
.comment-text { white-space:pre-wrap; overflow-wrap:anywhere }
.comment-empty,.social-login { color:var(--muted) }
.social-login a { color:var(--accent); text-decoration:underline }
.comment-form { margin-block:1.25rem; max-width:44rem }
.comment-form button { margin-top:.75rem }
.cover-preview img { width: min(100%, 28rem); border-radius: .55rem; }

dialog {
  width: min(100% - 2rem, 38rem);
  max-height: 90vh;
  padding: clamp(1.15rem, 3vw, 2rem);
  border: 1px solid var(--line);
  border-radius: .85rem;
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 18px 50px #25382c30;
}
dialog::backdrop { background: #23332b75; }
dialog > * + * { margin-top: 1rem; }

.site-footer {
  padding-block: 1.15rem;
  margin-top: 2.5rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: .85rem;
}

@media (max-width: 58rem) {
  .site-shell { width: min(100% - 2.5rem, 76rem); }
  .header-inner { gap: .65rem 1rem; }
  .project-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 42rem) {
  body { padding-inline:env(safe-area-inset-left) env(safe-area-inset-right); padding-bottom:env(safe-area-inset-bottom) }
  .site-header { padding-top:env(safe-area-inset-top) }
  .site-shell { width: calc(100% - 1.5rem); min-width:0 }
  .header-inner { flex-wrap: wrap; padding-block: .6rem; }
  .site-nav { order: 3; width: 100%; border-top: 1px solid var(--line); padding-top: .35rem; }
  .header-actions { margin-left: auto; }
  .hero { grid-template-columns: 1fr; padding-block: 1.7rem 2rem; gap: 1.5rem; }
  .hero-copy > * + * { margin-top: .85rem; }
  .section-head { margin-top: 1.65rem; }
  .project-grid { gap: .75rem; }
  .project-body { padding: .7rem; }
  .form-grid { grid-template-columns: 1fr; }
  .site-nav a,.site-nav button { min-height:44px; display:inline-flex; align-items:center; padding-inline:.5rem }
  .header-actions { min-width:0; max-width:100% }
  .brand { min-width:0; max-width:100% }
  .brand > span:last-child { overflow-wrap:anywhere }
  .panel,.form-grid > *,.detail-data { min-width:0 }
  .form-actions > * { max-width:100%; white-space:normal }
  .field input,.field select,.field textarea { min-width:0; scroll-margin-block:4rem }
  input[type=file] { overflow:hidden; font-size:.875rem }
  input[type=file]::file-selector-button { min-height:44px; margin-block:.15rem }
  dialog { max-height:calc(100dvh - 24px); overflow-y:auto; overscroll-behavior:contain }
  .comment-header button { min-height:44px }
}

@media (max-width: 29rem) {
  .project-grid { grid-template-columns: 1fr; }
  .brand { gap: .5rem; }
  .brand-mark { width: 2.05rem; height: 2.05rem; }
  .button-quiet { padding-inline: .55rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}

.gallery-filters { display:flex; flex-wrap:wrap; gap:.75rem; align-items:end; margin-block:1rem; padding:1rem; background:var(--surface); border:1px solid var(--line); border-radius:.75rem }
.gallery-filters .field { flex:1 1 10rem; min-width:0 }
.publication-preview { display:grid; gap:.6rem; border:1px solid var(--line); background:var(--surface); padding:1rem; border-radius:.75rem; margin-block:1rem; min-width:0 }
.publication-preview h2 { font-size:1.25rem }
.publication-preview-cover { width:min(100%,22rem); aspect-ratio:4 / 3; overflow:hidden; border-radius:.5rem }
.publication-preview-cover img { width:100%; height:100%; object-fit:cover }
.publication-privacy { font-size:.875rem; color:var(--muted) }
.publication-confirm { display:flex; align-items:start; gap:.65rem; margin-block:1rem; font-size:.95rem }
.publication-confirm input { flex:none; width:1.15rem; height:1.15rem; margin-top:.2rem; accent-color:var(--accent) }
@media(max-width:40rem) { .gallery-filters { padding:.75rem }.gallery-filters .field { flex-basis:100% }.gallery-filters button { min-height:44px } }
