:root {
  color-scheme: light;
  --paper: #fafbf8;
  --surface: #ffffff;
  --hero: #e8f0e9;
  --panel: #eef3ee;
  --ink: #172d2a;
  --muted: #4e625d;
  --accent: #11675e;
  --action: #165f56;
  --on-action: #ffffff;
  --line: #d2ddd6;
  --input-line: #627a70;
  --focus: #116ab2;
  --error: #a32635;
  --grid: rgba(39, 85, 71, .055);
  --shadow: 0 12px 32px rgba(19, 47, 37, .10);
  --sans: "DM Sans", Inter, system-ui, sans-serif;
  --serif: "DM Serif Text", Georgia, "Times New Roman", serif;
  --gutter: clamp(1rem, 4.5vw, 4rem);
  font-family: var(--sans);
  background: var(--paper);
  color: var(--ink);
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #111b19;
  --surface: #182622;
  --hero: #1b332e;
  --panel: #1d2c27;
  --ink: #edf4ef;
  --muted: #b4c6be;
  --accent: #93d8c5;
  --action: #9ddbc9;
  --on-action: #102a23;
  --line: #394c44;
  --input-line: #819b8e;
  --focus: #9ed7ff;
  --error: #ffabb1;
  --grid: rgba(164, 211, 191, .065);
  --shadow: 0 12px 32px rgba(0, 0, 0, .22);
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 0; font-size: 1rem; line-height: 1.55; }
button, input, select, textarea { font: inherit; color: inherit; }
button, summary { cursor: pointer; }
[hidden] { display: none !important; }
img { display: block; max-width: 100%; }
a { color: var(--accent); text-underline-offset: .2em; text-decoration-thickness: .08em; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; }
main:focus:not(:focus-visible) { outline: none; }
section[id], dt[id] { scroll-margin-block-start: 1.25rem; }
::selection { background: var(--action); color: var(--on-action); }
.wrap { width: min(74rem, calc(100% - 2 * var(--gutter))); margin-inline: auto; }
h1, h2, h3, p, dl, dd { margin: 0; }
h1, h2, h3 { text-wrap: balance; }
h1, h2 { color: var(--ink); }
.skip { position: fixed; z-index: 10; inset: .5rem auto auto .5rem; padding: .75rem 1rem; background: var(--surface); transform: translateY(-160%); }
.skip:focus { transform: none; }

.site-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar { min-height: 5rem; display: flex; align-items: center; gap: clamp(1rem, 2.8vw, 2.5rem); position: relative; }
.brand { display: inline-flex; align-items: center; gap: .62rem; color: var(--ink); text-decoration: none; flex: 0 0 auto; min-height: 44px; font-weight: 720; font-size: 1.04rem; line-height: 1.06; letter-spacing: -.035em; }
.brand-line { display: block; }
.brand-mark { width: 2.45rem; height: 2.45rem; display: grid; place-items: center; border-radius: .55rem; background: var(--action); color: var(--on-action); }
.brand-mark i { display: block; width: 1.65rem; height: .67rem; border: 1.6px solid currentColor; border-radius: 2px; transform: rotate(-39deg); position: relative; }
.brand-mark i::before { content: ""; position: absolute; left: .18rem; top: 0; width: 1.1rem; height: .26rem; background: repeating-linear-gradient(90deg, currentColor 0 1px, transparent 1px .28rem); }
.nav-links { display: flex; gap: clamp(.65rem, 1.8vw, 1.6rem); align-items: center; }
.nav-links a, .category-nav a { min-height: 44px; display: inline-flex; align-items: center; color: var(--muted); text-decoration: none; font-size: .94rem; font-weight: 580; }
.nav-links a:hover, .category-nav a:hover, .nav-links a[aria-current] { color: var(--accent); text-decoration: underline; }
.nav-links a[aria-current] { font-weight: 720; text-decoration-thickness: 2px; }
.desktop-nav { margin-left: auto; }
.theme-toggle, .mobile-menu summary { min-height: 44px; display: inline-flex; gap: .5rem; align-items: center; justify-content: center; border: 1px solid var(--input-line); border-radius: 100px; padding: .45rem .85rem; background: var(--surface); color: var(--ink); font-size: .875rem; font-weight: 620; white-space: nowrap; }
.theme-toggle:hover, .mobile-menu summary:hover { background: var(--panel); }
.theme-track { width: 1.56rem; height: .88rem; box-sizing: content-box; border: 1px solid var(--input-line); border-radius: 1rem; background: var(--panel); display: flex; align-items: center; padding-inline: .12rem; }
.theme-track i { width: .59rem; height: .59rem; background: var(--muted); border-radius: 50%; }
[aria-pressed="true"] .theme-track { background: var(--action); border-color: var(--action); }
[aria-pressed="true"] .theme-track i { margin-left: auto; background: var(--on-action); }
.mobile-menu { display: none; position: relative; }
.mobile-menu summary { list-style: none; user-select: none; }
.mobile-menu summary::-webkit-details-marker { display: none; }
.menu-icon { width: 1.08rem; height: .74rem; display: inline-block; border-block: 1.7px solid currentColor; position: relative; flex: none; }
.menu-icon::before { content: ""; position: absolute; height: 1.7px; background: currentColor; inset: 50% 0 auto; transform: translateY(-50%); }
.mobile-links { position: absolute; z-index: 3; right: 0; top: calc(100% + .55rem); min-width: 11.8rem; align-items: stretch; flex-direction: column; gap: 0; padding: .45rem; background: var(--surface); border: 1px solid var(--line); border-radius: .65rem; box-shadow: var(--shadow); }
.mobile-links a { padding: .35rem .7rem; }

.home-content { padding-block: clamp(1.25rem, 3vw, 2.6rem) clamp(3rem, 6vw, 5rem); }
.hero { display: grid; grid-template-columns: 1.04fr 1fr; border: 1px solid var(--line); border-radius: 1rem; overflow: hidden; background: var(--hero); }
.hero-copy { display: flex; align-items: start; flex-direction: column; justify-content: center; padding: clamp(2rem, 4.4vw, 4.2rem); background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px); background-size: 1.6rem 1.6rem; }
.hero h1, .page-intro h1, .error-content h1 { font-family: var(--serif); font-weight: 500; letter-spacing: -.055em; line-height: 1.02; }
.hero h1 { font-size: clamp(2.65rem, 4.65vw, 4.45rem); }
.hero h1 em { display: block; color: var(--accent); font-weight: inherit; }
.hero-copy p { color: var(--muted); max-width: 40ch; margin-top: 1.12rem; font-size: clamp(1rem, 1.4vw, 1.13rem); }
.primary-action { display: inline-flex; align-items: center; justify-content: center; min-height: 46px; border-radius: .48rem; padding: .7rem 1.2rem; margin-top: 1.55rem; background: var(--action); color: var(--on-action); font-size: .96rem; font-weight: 660; text-decoration: none; }
.primary-action:hover { text-decoration: underline; text-underline-offset: .24em; }
.hero-photo { min-width: 0; min-height: 21.5rem; position: relative; }
.hero-photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 50%; }
.projects { margin-top: clamp(2.4rem, 4.4vw, 4rem); }
.projects h2, .measure-guide h2, .directory-group h2 { font-size: clamp(1.5rem, 2.3vw, 2.05rem); line-height: 1.2; letter-spacing: -.047em; font-weight: 660; }
.project-grid { margin-top: 1.2rem; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(.8rem, 1.7vw, 1.4rem); }
.project-card { display: block; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: .72rem; text-decoration: none; color: var(--ink); }
.card-photo { width: 100%; aspect-ratio: 2.55; height: auto; object-fit: cover; border-bottom: 1px solid var(--line); }
.card-body { padding: clamp(.9rem, 1.6vw, 1.35rem); }
.card-body h3 { font-size: clamp(1.12rem, 1.6vw, 1.36rem); font-weight: 670; line-height: 1.26; letter-spacing: -.035em; }
.card-body p, .group-heading p { color: var(--muted); margin-top: .32rem; font-size: .98rem; }
.project-card:hover, .project-card:focus-visible { border-color: var(--accent); }
.project-card:hover h3 { color: var(--accent); text-decoration: underline; text-underline-offset: .18em; }
.measure-guide { margin-top: clamp(2.6rem, 5vw, 4.5rem); padding: clamp(1.2rem, 3vw, 2.35rem); background: var(--panel); border: 1px solid var(--line); border-radius: .8rem; display: grid; grid-template-columns: 1fr 1.65fr; gap: clamp(1.6rem, 5vw, 5rem); }
.guide-intro p { margin-top: .75rem; max-width: 32ch; color: var(--muted); }
.guide-list dt, .group-notes dt { font-weight: 670; line-height: 1.4; }
.guide-list dt:not(:first-child) { margin-top: 1.1rem; }
.guide-list dd, .group-notes dd { color: var(--muted); margin-top: .25rem; max-width: 66ch; }

.interior-content { padding-block: clamp(2rem, 4.8vw, 4.5rem) clamp(3rem, 6vw, 5.5rem); }
.page-intro { margin-bottom: 2.1rem; }
.page-intro h1, .error-content h1 { font-size: clamp(2.7rem, 5vw, 4.2rem); }
.page-intro > p, .error-content > p { color: var(--muted); max-width: 60ch; margin-top: .9rem; font-size: 1.08rem; }
.directory-layout { display: grid; grid-template-columns: minmax(12rem, .8fr) minmax(0, 2.3fr); align-items: start; gap: clamp(1.5rem, 3.5vw, 3.3rem); }
.category-nav { position: sticky; top: 1rem; padding: 1.15rem; border-radius: .65rem; background: var(--panel); border: 1px solid var(--line); display: grid; }
.category-nav h2 { margin-bottom: .45rem; font-size: 1rem; }
.category-nav a { width: fit-content; color: var(--accent); }
.directory-sections { display: grid; gap: 1.25rem; }
.directory-group { padding: clamp(1rem, 2.4vw, 2rem); background: var(--surface); border: 1px solid var(--line); border-radius: .75rem; }
.group-heading { display: flex; align-items: center; gap: 1.1rem; border-bottom: 1px solid var(--line); padding-bottom: 1.15rem; margin-bottom: 1.1rem; }
.group-heading img { flex: none; width: 6rem; height: 4.75rem; border-radius: .45rem; object-fit: cover; }
.directory-group h2 { font-size: clamp(1.26rem, 2.1vw, 1.68rem); }
.group-notes dt:not(:first-child) { margin-top: 1rem; }
.tool-links { list-style: none; margin: 0; padding: 0; }
.tool-links li + li { border-top: 1px solid var(--line); }
.tool-links a { display: grid; gap: .18rem; align-content: center; min-height: 44px; padding: .7rem .15rem; text-decoration: none; }
.tool-name { font-weight: 660; text-decoration: underline; text-underline-offset: .17em; }
.tool-summary { color: var(--muted); font-size: .94rem; line-height: 1.42; }
.tool-links a:hover .tool-name { text-decoration-thickness: .13em; }
.project-grid .tool-links { margin: .3rem .6rem 0; }
.directory-group .tool-links { margin: -.4rem 0 1.25rem; }
.guide-sections { max-width: 74ch; min-width: 0; }
.guide-sections > section + section { margin-top: 1.8rem; padding-top: 1.6rem; border-top: 1px solid var(--line); }
.guide-sections h2 { font-size: clamp(1.35rem, 2.5vw, 1.85rem); line-height: 1.22; letter-spacing: -.035em; }
.guide-sections h3 { font-size: 1.07rem; line-height: 1.35; }
.guide-sections p, .guide-sections dl { margin-top: .8rem; }
.method-list > div, .unit-list > div { padding-block: .75rem; }
.method-list > div + div, .unit-list > div + div { border-top: 1px solid var(--line); }
.method-list dt, .unit-list dt { font-weight: 670; }
.method-list dd { margin-top: .25rem; }
.unit-list > div { display: grid; grid-template-columns: 4.5rem minmax(0, 1fr); gap: .7rem; }
.guide-note { margin-top: 1.15rem; background: var(--panel); border-inline-start: .25rem solid var(--accent); border-radius: .35rem; padding: 1rem 1.2rem; }
.guide-note p { margin-top: .4rem; }
.error-content { min-height: 48vh; }
.site-footer { border-top: 1px solid var(--line); background: var(--surface); }
.footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-block: 1.5rem; }
.footer-nav { flex-wrap: wrap; }

label, legend { font-weight: 620; }
input, select, textarea { border: 1px solid var(--input-line); background: var(--surface); color: var(--ink); border-radius: .4rem; min-height: 44px; max-width: 100%; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
[aria-invalid="true"] { border: 2px solid var(--error); }
.field-error { color: var(--error); }
output, .result-panel { color: var(--ink); background: var(--panel); }
figure { max-width: 100%; margin-inline: 0; color: var(--ink); }
figcaption { color: var(--muted); }

@media (max-width: 50rem) {
  .topbar { min-height: 4.4rem; gap: .65rem; }
  .desktop-nav { display: none; }
  .topbar > .brand { margin-right: auto; }
  .mobile-menu { display: block; }
  .hero-copy { padding: clamp(1.35rem, 4vw, 2.5rem); }
  .hero-photo { min-height: 18.5rem; }
  .card-photo { aspect-ratio: 1.8; }
  .directory-layout { display: block; }
  .category-nav { position: static; margin-bottom: 1.25rem; display: flex; align-items: center; flex-wrap: wrap; gap: .15rem 1.1rem; }
  .category-nav h2 { flex-basis: 100%; margin: 0; }
}
@media (max-width: 40rem) {
  .hero { grid-template-columns: minmax(0, 1fr); }
  .hero-copy { padding: 1.75rem 1.35rem; }
  .hero h1 { font-size: clamp(2.45rem, 9vw, 3.55rem); }
  .hero-photo { min-height: 0; aspect-ratio: 2.15; }
  .hero-copy p { margin-top: .85rem; }
  .primary-action { margin-top: 1.15rem; }
  .project-grid { grid-template-columns: 1fr; }
  .project-card { display: grid; grid-template-columns: clamp(5rem, 25vw, 9rem) 1fr; align-items: stretch; }
  .card-photo { height: 100%; min-height: 6rem; width: 100%; aspect-ratio: auto; border-bottom: 0; }
  .card-body { align-self: center; }
  .measure-guide { grid-template-columns: 1fr; gap: 1.1rem; }
  .footer-inner { align-items: flex-start; flex-direction: column; }
  .footer-nav { gap: .3rem 1rem; }
  .group-heading { gap: .75rem; }
  .group-heading img { width: 4rem; height: 3.75rem; }
}
@media (max-width: 30rem) {
  .topbar { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: .4rem; }
  .topbar > .brand { margin: 0; min-width: 0; justify-self: start; }
  .brand-mark { flex: none; }
  .theme-toggle .theme-track { display: none; }
  .theme-toggle[aria-pressed="true"] { background: var(--action); border-color: var(--action); color: var(--on-action); }
  .brand { gap: .42rem; font-size: .94rem; }
  .brand-mark { width: 2.05rem; height: 2.05rem; }
  .theme-toggle { padding-inline: .6rem; }
  .menu-text { display: none; }
  .mobile-menu summary { width: 44px; padding: 0; }
}
