:root {
  --ink: #18231d;
  --paper: #f3f0e8;
  --paper-deep: #e7e1d5;
  --accent: #d84b31;
  --accent-dark: #ad321f;
  --moss: #617565;
  --line: rgba(24, 35, 29, 0.18);
  --serif: "Newsreader", Georgia, serif;
  --sans: "DM Sans", sans-serif;
}

* { box-sizing: border-box; }

html { background: var(--paper); }

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(rgba(24, 35, 29, 0.035) 1px, transparent 1px),
    var(--paper);
  background-size: 100% 32px;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
}

a { color: inherit; }

img { display: block; max-width: 100%; }

.site-header,
.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto;
}

.site-header { min-height: 92px; justify-content: flex-start; gap: 24px; border-bottom: 1px solid var(--line); }

.wordmark { display: flex; align-items: center; gap: 10px; font-weight: 600; text-decoration: none; }

.wordmark-mark {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  color: var(--paper);
  background: var(--ink);
  font-family: var(--serif);
  font-size: 20px;
}

.header-action,
.text-link { font-size: 14px; font-weight: 600; text-underline-offset: 5px; }

.account-nav { display: flex; align-items: center; gap: 16px; }
.account-nav form { margin: 0; }
.account-nav button { border: 0; background: transparent; color: inherit; cursor: pointer; font-family: inherit; text-decoration: underline; }
.return-link { margin-left: auto; padding: 10px 16px; border: 1px solid var(--ink); border-radius: 4px; font-size: 14px; font-weight: 600; text-decoration: none; }
.return-link:hover { background: var(--ink); color: var(--paper); }
.return-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
select { max-width: 100%; padding: 12px; border: 1px solid var(--line); background: var(--paper); color: var(--ink); font: inherit; }

main { min-height: calc(100vh - 180px); }

.intro,
.profile-section,
.form-shell,
.profile-view,
.not-found {
  width: min(1180px, calc(100% - 48px));
  margin-inline: auto;
}

.intro { padding: 104px 0 88px; }

.eyebrow {
  margin: 0 0 20px;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p { margin-top: 0; }

h1,
h2,
h3 { font-family: var(--serif); font-weight: 500; line-height: 0.98; }

.intro h1,
.form-intro h1 { max-width: 820px; margin-bottom: 28px; font-size: clamp(52px, 8vw, 104px); }

.intro-copy,
.form-intro > p:last-child { max-width: 540px; color: var(--moss); font-size: 18px; }

.profile-section { padding-bottom: 120px; }

.section-heading { display: flex; align-items: baseline; justify-content: space-between; padding: 20px 0; border-top: 1px solid var(--ink); }
.section-heading h2 { margin: 0; font-size: 28px; }
.section-heading span { color: var(--moss); font-size: 13px; }

.profile-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px 20px; }

.profile-card { min-width: 0; text-decoration: none; }
.profile-card img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; filter: saturate(0.82); transition: filter 180ms ease, transform 180ms ease; }
.profile-card:hover img { filter: saturate(1); transform: translateY(-4px); }
.profile-card-copy { padding: 18px 4px; }
.profile-card h3 { margin-bottom: 10px; font-size: 30px; }
.profile-card p { display: -webkit-box; min-height: 52px; margin-bottom: 18px; overflow: hidden; color: var(--moss); -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.profile-card-copy > span { color: var(--accent-dark); font-size: 13px; font-weight: 600; }

.empty-state { padding: 72px 0; text-align: center; border-bottom: 1px solid var(--line); }
.empty-state p { font-family: var(--serif); font-size: 32px; }

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  min-height: 50px;
  padding: 12px 22px;
  border: 0;
  border-radius: 2px;
  color: white;
  background: var(--accent);
  font: 600 14px var(--sans);
  text-decoration: none;
  cursor: pointer;
  transition: background 160ms ease;
}
.primary-button:hover { background: var(--accent-dark); }

.form-shell { display: grid; grid-template-columns: 1fr minmax(360px, 500px); gap: 9vw; padding: 96px 0 120px; }
.form-intro { position: sticky; top: 40px; align-self: start; }
.profile-form { padding-top: 12px; }

.field { margin-bottom: 32px; }
.field > label:first-child { display: block; margin-bottom: 8px; font-weight: 600; }
.field input[type="text"],
.field input[type="password"],
.field textarea {
  width: 100%;
  padding: 14px 0;
  border: 0;
  border-bottom: 1px solid var(--ink);
  border-radius: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font: 18px var(--sans);
  resize: vertical;
}
.field input:focus,
.field textarea:focus { border-color: var(--accent); box-shadow: 0 1px 0 var(--accent); }
.field-note { display: block; margin-top: 7px; color: var(--moss); font-size: 12px; }

.upload-area {
  display: grid;
  min-height: 190px;
  place-content: center;
  padding: 24px;
  border: 1px dashed var(--moss);
  text-align: center;
  cursor: pointer;
}
.upload-area:hover { border-color: var(--accent); background: rgba(216, 75, 49, 0.04); }
.upload-area strong { margin: 8px 0 2px; }
.upload-area span:last-child { color: var(--moss); font-size: 12px; }
.upload-icon { color: var(--accent); font-family: var(--serif); font-size: 30px; }
.file-input { width: 100%; margin-top: 10px; font: 12px var(--sans); }

.error-panel { margin-bottom: 30px; padding: 18px 20px; border-left: 3px solid var(--accent); background: rgba(216, 75, 49, 0.08); }
.error-panel ul { margin: 6px 0 0; padding-left: 20px; }

.profile-view { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr); min-height: calc(100vh - 92px); }
.portrait-frame { min-height: 640px; margin-left: calc((1180px - 100vw) / 2); background: var(--paper-deep); }
.portrait-frame img { width: 100%; height: 100%; object-fit: cover; }
.profile-story { align-self: center; padding: 80px clamp(32px, 8vw, 120px); }
.profile-story h1 { margin-bottom: 36px; font-size: clamp(58px, 7vw, 96px); overflow-wrap: anywhere; }
.profile-story .bio { max-width: 560px; margin-bottom: 50px; font-family: var(--serif); font-size: clamp(24px, 2.6vw, 36px); line-height: 1.3; white-space: pre-line; }

.not-found { padding: 15vh 0; text-align: center; }
.not-found h1 { margin: 0 auto 40px; font-size: clamp(48px, 8vw, 96px); }

.oauth-shell {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(420px, 1.1fr);
  gap: 8vw;
  width: min(1040px, calc(100% - 48px));
  margin: 0 auto;
  padding: 96px 0 120px;
}
.oauth-intro h1 { margin-bottom: 28px; font-size: clamp(44px, 5vw, 70px); line-height: 1.04; }
.oauth-intro > p:last-child { max-width: 480px; color: var(--moss); font-size: 17px; }
.consent-form fieldset { margin: 0 0 28px; padding: 0; border: 0; }
.consent-form legend { width: 100%; padding: 0 0 12px; border-bottom: 1px solid var(--ink); font-family: var(--serif); font-size: 26px; }
.identity-list { display: grid; gap: 1px; margin: 16px 0 0; background: var(--line); }
.identity-option { display: grid; grid-template-columns: auto 64px minmax(0, 1fr); gap: 16px; align-items: center; min-height: 90px; padding: 12px 16px; background: var(--paper); cursor: pointer; }
.identity-option:has(input:checked) { outline: 2px solid var(--accent); outline-offset: -2px; }
.identity-option input { accent-color: var(--accent); }
.identity-option img { width: 64px; height: 64px; object-fit: cover; }
.identity-option span { min-width: 0; }
.identity-option strong, .identity-option small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.identity-option small { color: var(--moss); }

.site-footer { min-height: 88px; color: var(--moss); border-top: 1px solid var(--line); font-size: 12px; }

@media (max-width: 760px) {
  .site-header, .site-footer, .intro, .profile-section, .form-shell, .profile-view, .not-found { width: min(100% - 28px, 1180px); }
  .site-header { min-height: 72px; flex-wrap: wrap; gap: 12px 16px; padding-block: 14px; }
  .account-nav { flex-wrap: wrap; gap: 12px; }
  .return-link { padding: 8px 12px; }
  .intro { padding: 72px 0 60px; }
  .intro h1, .form-intro h1 { font-size: 52px; }
  .profile-grid { grid-template-columns: 1fr; gap: 36px; }
  .form-shell { display: block; padding: 64px 0 90px; }
  .form-intro { position: static; margin-bottom: 60px; }
  .profile-view { display: flex; min-height: auto; flex-direction: column; }
  .portrait-frame { width: calc(100% + 28px); min-height: 0; margin-left: -14px; aspect-ratio: 4 / 5; }
  .profile-story { padding: 64px 0 90px; }
  .profile-story h1 { font-size: 60px; }
  .oauth-shell { display: block; width: min(100% - 28px, 1040px); padding: 64px 0 90px; }
  .oauth-intro { margin-bottom: 48px; }
  .oauth-intro h1 { font-size: 44px; }
  .identity-option { grid-template-columns: auto 52px minmax(0, 1fr); gap: 12px; padding-inline: 10px; }
  .identity-option img { width: 52px; height: 52px; }
  .site-footer { align-items: flex-start; flex-direction: column; justify-content: center; gap: 2px; }
}
