:root {
  color-scheme: light;
  --bg: #f4f0e8;
  --paper: #fffdf8;
  --ink: #171717;
  --muted: #69635b;
  --line: #ded6c8;
  --accent: #c98b2c;
  --accent-ink: #2a1706;
  --soft: #eee7dc;
  --shadow: 0 24px 80px rgba(38, 31, 22, 0.12);
  --radius: 18px;
  --max: 1120px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 10% 0%, rgba(201, 139, 44, 0.18), transparent 32rem),
    linear-gradient(180deg, #f4f0e8, #ebe4d8);
  color: var(--ink);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.6;
}

body.locked-admin main,
body.locked-admin .footer {
  display: none;
}

.admin-page .admin-main,
.admin-page .editor-module,
.admin-page .admin-list {
  overflow-anchor: none;
}

.access-gate {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.access-gate-card {
  display: grid;
  gap: 14px;
  width: min(100%, 420px);
  padding: 28px;
  border: 1px solid rgba(23, 23, 23, 0.1);
  border-radius: var(--radius);
  background: rgba(255, 253, 248, 0.92);
  box-shadow: var(--shadow);
}

.access-gate-card > span {
  color: var(--accent);
  font-family: "Roboto Mono", monospace;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.access-gate-card h1 {
  margin: 0;
  font-size: clamp(2rem, 6vw, 3.4rem);
  line-height: 1;
}

.access-gate-card p {
  margin: 0;
  color: var(--muted);
}

.access-gate-card label {
  display: grid;
  gap: 8px;
}

.access-gate-card label span {
  color: var(--muted);
  font-weight: 800;
}

.access-gate-card input {
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  color: var(--ink);
  outline: none;
}

.access-gate-card input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(201, 139, 44, 0.14);
}

.access-error {
  min-height: 24px;
  color: #b42318 !important;
  font-weight: 800;
}

a {
  color: inherit;
  text-decoration: none;
}

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

button,
input,
textarea,
select {
  font: inherit;
}

.topbar,
.site-container,
.footer {
  width: min(calc(100% - 32px), var(--max));
  margin-inline: auto;
}

.topbar {
  position: fixed;
  top: 14px;
  left: 50%;
  z-index: 70;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 18px;
  margin-top: 0;
  padding: 10px;
  transform: translateX(-50%);
  border: 1px solid rgba(23, 23, 23, 0.1);
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.78);
  box-shadow: 0 18px 50px rgba(38, 31, 22, 0.08);
  backdrop-filter: blur(18px);
}

.identity,
.topnav,
.quick-actions,
.social-row,
.badge-row,
.admin-actions {
  display: flex;
  align-items: center;
}

.identity {
  gap: 10px;
  font-weight: 800;
}

.identity-logo {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  overflow: hidden;
  border-radius: 50%;
  background: #050505;
}

.identity-logo img {
  width: 112%;
  height: 112%;
  object-fit: cover;
}

.topnav {
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.menu-toggle {
  display: none;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(23, 23, 23, 0.12);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
}

.menu-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 99px;
  background: currentColor;
}

.topnav a {
  padding: 9px 11px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.topnav a:hover {
  background: var(--soft);
  color: var(--ink);
}

.site-container {
  padding: 126px 0 72px;
}

.profile-shell {
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.profile-shell > *,
.module-grid > *,
.two-column > *,
.admin-panel > * {
  min-width: 0;
}

.profile-card,
.module,
.hero-panel,
.directory-card,
.project-tile,
.gallery-item,
.editor-module,
.admin-nav {
  border: 1px solid rgba(23, 23, 23, 0.1);
  border-radius: var(--radius);
  background: rgba(255, 253, 248, 0.78);
  box-shadow: var(--shadow);
}

.profile-card {
  position: sticky;
  top: 96px;
  padding: 18px;
  width: 100%;
  max-width: 330px;
}

.portrait {
  overflow: hidden;
  aspect-ratio: 1 / 1.08;
  max-height: 320px;
  border-radius: 16px;
  background: var(--soft);
}

.portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 18%;
}

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

.profile-card h1 {
  margin: 18px 0 2px;
  font-size: 2.1rem;
  line-height: 1;
}

.location,
.descriptor,
.prose,
.module p,
.project-tile p,
.page-head p {
  color: var(--muted);
}

.descriptor {
  font-family: "Roboto Mono", monospace;
  font-size: 0.85rem;
}

.quick-actions {
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 10px 14px;
  border: 1px solid rgba(23, 23, 23, 0.12);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 800;
  cursor: pointer;
}

.btn.primary {
  border-color: transparent;
  background: var(--accent);
  color: white;
}

.social-row {
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
  color: var(--accent-ink);
  font-weight: 800;
}

.social-icon {
  display: inline-grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(23, 23, 23, 0.12);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  transition: transform 160ms ease, background 160ms ease;
}

.social-icon:hover {
  transform: translateY(-2px);
  background: var(--soft);
}

.social-icon svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.profile-main {
  display: grid;
  gap: 18px;
  width: 100%;
  max-width: 100%;
}

.profile-main > * {
  width: 100%;
  max-width: 100%;
}

.hero-panel {
  padding: clamp(24px, 5vw, 48px);
}

.hero-panel > p:not(.eyebrow) {
  margin-bottom: 0;
}

.eyebrow,
.page-head .back,
.editor-module span {
  color: var(--accent);
  font-family: "Roboto Mono", monospace;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.hero-panel h2,
.page-head h1 {
  max-width: 700px;
  margin-bottom: 18px;
  font-size: clamp(1.45rem, 3vw, 2.9rem);
  line-height: 1.05;
  letter-spacing: 0;
}

.hero-panel p:not(.eyebrow),
.page-head p {
  max-width: 680px;
  font-size: 1.08rem;
  line-height: 1.75;
  text-align: left;
}

.badge-row {
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.badge-card {
  display: grid;
  gap: 4px;
  min-width: min(100%, 290px);
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fbf6ed;
}

.badge-card span,
.project-tile span,
.directory-card span {
  color: var(--accent);
  font-family: "Roboto Mono", monospace;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.module {
  padding: clamp(20px, 4vw, 32px);
}

.module-heading {
  margin-bottom: 18px;
}

.module-heading h2 {
  margin: 0;
  font-size: clamp(1.45rem, 2.2vw, 2.05rem);
  line-height: 1.08;
}

.module-heading.with-link {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
}

.module-heading a,
.back {
  color: var(--accent-ink);
  font-size: 0.92rem;
  font-weight: 800;
  white-space: nowrap;
}

.access-card {
  margin-top: 22px;
  padding: 20px;
  border-radius: 16px;
  background: #171717;
  color: white;
}

.access-card h3 {
  margin-bottom: 18px;
  color: #ffd083;
}

.access-card strong {
  display: block;
  font-size: 2.4rem;
  line-height: 1;
}

.access-card div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.access-card small {
  padding: 6px 9px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
}

.timeline-list,
.academic-list,
.compact-list,
.stack-preview,
.quote-list {
  display: grid;
  gap: 10px;
}

.timeline-item,
.academic-item,
.compact-list a,
.stack-preview article,
.cert-row article {
  display: grid;
  gap: 10px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.stack-preview article {
  grid-template-columns: minmax(112px, 0.42fr) minmax(0, 1fr);
  align-items: start;
}

.timeline-item h3,
.academic-item h3,
.stack-preview h3 {
  margin-bottom: 0;
  font-size: 0.98rem;
  line-height: 1.25;
}

.academic-item {
  grid-template-columns: minmax(0, 0.44fr) minmax(0, 1fr);
  align-items: start;
}

.academic-item span {
  color: var(--accent);
  font-weight: 850;
}

.academic-item strong {
  display: block;
  color: var(--muted);
  font-size: 0.92rem;
}

.academic-item p {
  margin: 0;
}

.stack-preview p,
.compact-list span,
.cert-row span {
  margin: 0;
  color: var(--muted);
  font-size: 0.96rem;
  line-height: 1.55;
}

.timeline-item span {
  flex: 0 0 auto;
  color: var(--accent);
  font-weight: 800;
}

.module-grid,
.two-column {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.compact-list a,
.cert-row article {
  display: grid;
}

.compact-list a {
  gap: 8px;
}

.compact-list strong,
.cert-row strong {
  font-size: 0.98rem;
  line-height: 1.25;
}

.compact-list span,
.cert-row span {
  color: var(--muted);
}

.module-grid .module {
  padding: clamp(20px, 3vw, 26px);
}

.module-grid .module-heading h2 {
  font-size: clamp(1.65rem, 2.5vw, 2.25rem);
  line-height: 1.05;
}

.cert-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 18px;
}

blockquote {
  margin: 0;
  padding: 18px 0;
  border-top: 1px solid var(--line);
}

blockquote p {
  color: var(--ink) !important;
}

blockquote span {
  display: block;
  color: var(--muted);
}

.link-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.link-cloud a,
.pill-list span {
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fbf6ed;
  font-weight: 700;
}

.contact-line {
  display: grid;
  margin: 18px 0;
}

.contact-line span {
  color: var(--muted);
}

.contact-line a {
  font-size: 1.4rem;
  font-weight: 800;
}

.page-head {
  padding: 34px 0;
}

.directory-grid,
.project-directory,
.gallery-wall {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.directory-card,
.project-tile {
  display: grid;
  gap: 12px;
  padding: 24px;
}

.directory-card h2,
.project-tile h2 {
  margin: 0;
  font-size: clamp(1.35rem, 3vw, 2.4rem);
  line-height: 1;
}

.pill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.project-tile small {
  color: var(--muted);
  font-weight: 800;
}

.gallery-item {
  overflow: hidden;
}

.gallery-item img {
  width: 100%;
  height: 320px;
  object-fit: cover;
}

.gallery-item h2 {
  padding: 18px;
}

.chat-toggle {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 45;
  min-height: 48px;
  max-width: calc(100vw - 170px);
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: white;
  font-size: 0.95rem;
  font-weight: 800;
  box-shadow: var(--shadow);
  cursor: pointer;
  white-space: nowrap;
}

.chat-panel {
  position: fixed;
  right: 20px;
  bottom: 82px;
  z-index: 45;
  width: min(320px, calc(100% - 36px));
  padding: 18px;
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.admin-panel {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.admin-nav {
  position: sticky;
  top: 96px;
  display: grid;
  gap: 6px;
  max-height: calc(100vh - 120px);
  overflow: auto;
  padding: 12px;
  border: 1px solid rgba(23, 23, 23, 0.08);
  border-radius: var(--radius);
  background: rgba(255, 253, 248, 0.72);
}

.admin-nav a {
  display: flex;
  align-items: center;
  min-height: 38px;
  padding: 8px 11px;
  border-radius: 12px;
  color: var(--muted);
  font-weight: 800;
}

.admin-nav a:hover {
  background: var(--soft);
  color: var(--ink);
}

.admin-main {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.admin-actions {
  position: sticky;
  top: 88px;
  z-index: 10;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px;
  border: 1px solid rgba(23, 23, 23, 0.08);
  border-radius: var(--radius);
  background: rgba(255, 253, 248, 0.88);
  box-shadow: 0 16px 50px rgba(38, 31, 22, 0.08);
  backdrop-filter: blur(14px);
}

.import-control input,
.upload-btn input {
  display: none;
}

.admin-status {
  min-height: 28px;
  margin: 0;
  padding: 0 4px;
  color: var(--accent-ink);
  font-weight: 800;
}

.admin-status.error {
  color: #b42318;
}

.editor-module {
  display: grid;
  gap: 18px;
  margin-bottom: 18px;
  padding: clamp(18px, 3vw, 28px);
  scroll-margin-top: 188px;
}

.editor-module-head {
  display: grid;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.editor-module h2 {
  margin: 4px 0 6px;
  font-size: clamp(1.45rem, 2.2vw, 2.1rem);
  line-height: 1.05;
}

.editor-module p {
  max-width: 620px;
  margin: 0;
  color: var(--muted);
}

.section-save-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 4px;
}

.section-status {
  min-height: 20px;
  color: var(--accent-ink);
  font-size: 0.82rem;
  font-weight: 850;
  text-align: right;
  opacity: 0;
  transform: translateY(-2px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.section-status.visible {
  opacity: 1;
  transform: translateY(0);
}

.section-status.error {
  color: #b42318;
}

.admin-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 12px;
}

.admin-field {
  display: grid;
  align-content: start;
  gap: 7px;
  min-width: 0;
}

.textarea-field {
  grid-column: 1 / -1;
}

.admin-field span {
  color: var(--ink);
  font-family: Inter, system-ui, sans-serif;
  font-size: 0.8rem;
  font-weight: 850;
  line-height: 1.2;
  text-transform: none;
}

.admin-field small,
.admin-card-head small {
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.35;
}

.admin-field input,
.admin-field textarea,
.admin-field select {
  width: 100%;
  min-height: 40px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 253, 248, 0.92);
  color: var(--ink);
  font-size: 0.94rem;
  outline: none;
}

.admin-field textarea {
  min-height: 118px;
  line-height: 1.55;
  resize: vertical;
}

.admin-field input:focus,
.admin-field textarea:focus,
.admin-field select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(201, 139, 44, 0.14);
}

.admin-list {
  display: grid;
  gap: 10px;
}

.admin-edit-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fbf6ed;
}

.admin-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.admin-card-head strong {
  display: block;
  font-size: 0.98rem;
  line-height: 1.2;
}

.icon-btn {
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid rgba(23, 23, 23, 0.12);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  font-size: 0.76rem;
  font-weight: 850;
  cursor: pointer;
}

.icon-btn.danger {
  color: #8f1d15;
}

.add-btn {
  justify-self: start;
}

.compact-card {
  gap: 10px;
  padding: 12px;
}

.compact-card .admin-card-head {
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(222, 214, 200, 0.72);
}

.compact-card .admin-form-grid {
  gap: 10px;
}

.compact-card .admin-field input {
  min-height: 38px;
}

.image-picker {
  grid-column: span 2;
}

.image-picker-preview {
  display: grid;
  width: min(100%, 420px);
  min-height: 190px;
  overflow: hidden;
  place-items: center;
  border: 1px dashed rgba(23, 23, 23, 0.2);
  border-radius: 16px;
  background:
    linear-gradient(45deg, rgba(23, 23, 23, 0.04) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(23, 23, 23, 0.04) 25%, transparent 25%),
    var(--paper);
  background-position: 0 0, 0 10px;
  background-size: 20px 20px;
}

.image-picker-preview img {
  width: 100%;
  max-height: 260px;
  object-fit: contain;
}

.image-picker-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  width: min(100%, 720px);
}

.image-source {
  min-width: min(100%, 360px);
}

.image-source summary {
  min-height: 40px;
  padding: 9px 12px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
  cursor: pointer;
}

.image-source input {
  margin-top: 6px;
}

.admin-toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 80;
  max-width: min(420px, calc(100vw - 36px));
  padding: 14px 16px;
  border: 1px solid rgba(23, 23, 23, 0.12);
  border-radius: 16px;
  background: #171717;
  color: #fffdf8;
  font-weight: 850;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.admin-toast.visible {
  opacity: 1;
  transform: translateY(0);
}

.admin-toast.error {
  background: #8f1d15;
}

.admin-scroll-top {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 75;
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border: 1px solid rgba(23, 23, 23, 0.12);
  border-radius: 999px;
  background: #171717;
  color: #fffdf8;
  font-size: 1.2rem;
  font-weight: 900;
  box-shadow: var(--shadow);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.admin-scroll-top.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.admin-page .admin-toast {
  bottom: 76px;
}

.footer {
  position: relative;
  z-index: 25;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 26px 0 92px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9rem;
}

.footer .manage-chip {
  position: fixed;
  left: 20px;
  bottom: 20px;
  z-index: 45;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  max-width: calc(100vw - 170px);
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.92);
  color: var(--accent-ink);
  font-size: 0.88rem;
  font-weight: 800;
  box-shadow: 0 14px 40px rgba(38, 31, 22, 0.12);
  backdrop-filter: blur(12px);
  white-space: nowrap;
}

.footer .manage-chip:hover {
  background: var(--paper);
  transform: translateY(-1px);
}

.admin-page .footer .manage-chip {
  display: none;
}

.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 500ms ease, transform 500ms ease;
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

.admin-page .reveal {
  opacity: 1;
  transform: none;
}

@media (max-width: 900px) {
  .topbar {
    align-items: center;
    border-radius: 22px;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
  }

  .menu-toggle {
    display: grid;
    gap: 4px;
  }

  .topnav {
    grid-column: 1 / -1;
    display: none;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    justify-content: stretch;
    width: 100%;
    gap: 6px;
    padding-top: 8px;
    border-top: 1px solid var(--line);
  }

  .menu-open .topnav {
    display: grid;
  }

  .topnav a {
    display: inline-flex;
    justify-content: center;
    min-height: 38px;
    padding: 8px 7px;
    background: rgba(255, 253, 248, 0.72);
    font-size: 0.8rem;
  }

  .profile-shell,
  .module-grid,
  .two-column,
  .directory-grid,
  .project-directory,
  .gallery-wall,
  .admin-panel {
    grid-template-columns: 1fr;
  }

  .profile-card,
  .admin-nav {
    position: static;
  }

  .admin-nav {
    display: flex;
    gap: 8px;
    max-height: none;
    overflow-x: auto;
    padding: 10px;
    scroll-snap-type: x proximity;
  }

  .admin-nav a {
    flex: 0 0 auto;
    min-height: 36px;
    white-space: nowrap;
    scroll-snap-align: start;
  }

  .admin-actions {
    position: static;
  }

  .admin-form-grid {
    grid-template-columns: 1fr;
  }

  .image-picker {
    grid-column: auto;
  }

  .profile-shell {
    gap: 14px;
  }

  .profile-card {
    max-width: 420px;
    margin-inline: auto;
  }

  .portrait {
    max-height: 360px;
  }

  .cert-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .topbar,
  .site-container,
  .footer {
    width: min(calc(100% - 22px), var(--max));
  }

  .site-container,
  .profile-shell,
  .profile-main {
    overflow-x: clip;
  }

  .site-container {
    padding-top: 104px;
  }

  .topbar {
    top: 8px;
    margin-top: 0;
    padding: 9px;
  }

  .identity {
    min-width: 0;
  }

  .identity > span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .topnav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .topnav a {
    min-height: 36px;
    justify-content: center;
    padding: 8px 11px;
    font-size: 0.84rem;
  }

  .profile-card {
    max-width: 100%;
  }

  .portrait {
    max-height: 300px;
  }

  .profile-card h1 {
    font-size: 1.85rem;
  }

  .hero-panel h2,
  .page-head h1 {
    font-size: clamp(1.6rem, 8vw, 2.55rem);
    line-height: 1.08;
  }

  .timeline-item {
    display: grid;
  }

  .academic-item {
    grid-template-columns: 1fr;
  }

  .footer {
    flex-direction: column;
  }

  .chat-toggle {
    right: 11px;
    bottom: 12px;
    min-height: 42px;
    max-width: calc(100vw - 155px);
    padding: 0 13px;
    font-size: 0.82rem;
  }

  .chat-panel {
    right: 11px;
    bottom: 64px;
    width: min(320px, calc(100vw - 22px));
  }

  .footer {
    padding-bottom: 84px;
  }

  .footer .manage-chip {
    left: 11px;
    bottom: 12px;
    min-height: 42px;
    max-width: 138px;
    padding: 0 12px;
    font-size: 0.82rem;
  }

  .editor-module-head,
  .image-picker-controls,
  .admin-card-head {
    grid-template-columns: 1fr;
  }

  .editor-module-head {
    display: grid;
  }

  .admin-card-head {
    display: grid;
  }

  .admin-card-head .icon-btn {
    justify-self: start;
  }

  .section-save-tools {
    justify-content: stretch;
  }

  .section-save-tools .btn {
    flex: 1;
  }

  .image-picker-controls .btn {
    width: 100%;
  }

  .image-source {
    width: 100%;
  }
}

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