:root {
  --stage: #e8ded0;
  --card: #f5f0e8;
  --ink: #4a4339;
  --muted: #918a80;
  --line: rgba(74, 67, 57, .2);
  --shadow: 0 24px 64px rgba(62, 51, 38, .12), 0 2px 8px rgba(62, 51, 38, .05);
  --portfolio-card-height: 630px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  overflow-x: hidden;
  color: var(--ink);
  background: var(--stage);
  font-family: Arial, "Helvetica Neue", sans-serif;
  font-size: 14px;
  line-height: 1.35;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { color: inherit; font: inherit; }
button, a { touch-action: manipulation; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

.stage,
.legal-page {
  min-height: 100dvh;
  padding: max(12px, env(safe-area-inset-top)) 10px max(12px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
}

.card-stack { width: 100%; max-width: 510px; margin: auto; }
.card-stack .card, .card-stack .legal-card { margin: 0; }

.card {
  width: 100%;
  max-width: 510px;
  height: var(--portfolio-card-height);
  margin: auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(74,67,57,.08);
  border-radius: 22px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.cover {
  position: relative;
  flex: 0 0 auto;
  height: clamp(190px, 58vw, 225px);
  margin: 8px 8px 0;
  overflow: hidden;
  border-radius: 16px 16px 5px 5px;
  background: #e2d6c5;
}

.hero-art { width: 100%; height: 100%; display: block; object-fit: cover; object-position: center; transform: scale(1.02); }

.language {
  position: absolute;
  z-index: 4;
  top: 10px;
  right: 10px;
  width: 48px;
  height: 44px;
  border: 1px solid rgba(74,67,57,.14);
  border-radius: 999px;
  color: var(--ink);
  background: rgba(245,240,232,.92);
  box-shadow: 0 3px 10px rgba(62,51,38,.08);
  cursor: pointer;
  font-size: 10px;
  font-weight: 700;
}

.identity { position: relative; flex: 1 1 auto; padding: 72px 18px 28px; }

.portrait {
  position: absolute;
  top: -47px;
  left: 16px;
  width: 100px;
  height: 100px;
  overflow: hidden;
  border: 6px solid var(--card);
  border-radius: 50%;
  background: var(--ink);
  box-shadow: 0 0 0 1px rgba(74,67,57,.12);
}

.portrait img { width: 100%; height: 100%; display: block; object-fit: cover; object-position: 52% 38%; }

h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(34px, 10.5vw, 43px);
  line-height: 1;
  letter-spacing: -.045em;
  font-weight: 400;
}

.role {
  margin: 13px 0 0;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.4;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .075em;
}

.statement {
  max-width: 400px;
  margin: 16px 0 0;
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(18px, 5.7vw, 21px);
  line-height: 1.18;
  letter-spacing: -.02em;
  text-wrap: balance;
}

.actions {
  flex: 0 0 auto;
  height: 80px;
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  background: #eee6da;
  border-top: 1px solid rgba(74,67,57,.1);
}

.actions a {
  width: 100%;
  min-height: 56px;
  height: 100%;
  padding: 0 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--ink);
}

.actions strong { font-family: Georgia, "Times New Roman", serif; font-size: 17px; font-weight: 400; }
.site-meta { min-height: 52px; margin-top: 5px; display: flex; align-items: center; justify-content: center; gap: 14px; color: rgba(74,67,57,.8); font-size: 9px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; }
.site-meta > span { white-space: nowrap; }
.site-legal { display: flex; align-items: center; gap: 14px; }
.site-legal a { min-height: 44px; padding: 0 4px; display: flex; align-items: center; }
.mail-icon { position: relative; width: 18px; height: 13px; flex: 0 0 auto; border: 1px solid var(--ink); border-radius: 2px; }
.mail-icon::before, .mail-icon::after { content: ""; position: absolute; top: 3px; width: 10px; border-top: 1px solid var(--ink); }
.mail-icon::before { left: 0; transform: rotate(34deg); }
.mail-icon::after { right: 0; transform: rotate(-34deg); }

@media (min-width: 351px) {
  .identity { padding-inline: 22px; }
  .portrait { top: -49px; left: 20px; width: 104px; height: 104px; }
  .actions a { padding-inline: 22px; }
}

@media (min-width: 541px) {
  .stage, .legal-page { min-height: 100svh; padding: 42px 20px 26px; display: grid; place-items: center; align-content: center; gap: 22px; }
  .card { width: min(100%, 510px); border-radius: 24px; }
  .cover { height: 250px; margin: 12px 12px 0; border-radius: 15px 15px 5px 5px; }
  .language { top: 14px; right: 14px; width: 52px; height: 36px; }
  .identity { padding: 76px 46px 38px; }
  .portrait { top: -55px; left: 38px; width: 112px; height: 112px; border-width: 7px; }
  h1 { font-size: 48px; }
  .role { margin-top: 15px; font-size: 10px; }
  .statement { margin-top: 19px; font-size: 21px; }
  .actions { height: 84px; }
  .actions a { padding: 0 38px; }
}

@media (hover: hover) {
  a, button { transition: opacity .18s ease, transform .18s ease; }
  a:hover, button:hover { opacity: .62; }
  .actions a:hover { opacity: .78; }
}

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

/* 404 */
.error-page {
  min-height: 100dvh;
  padding: 20px;
  display: grid;
  place-items: center;
  background: var(--stage);
}

.error-card {
  width: min(100%, 510px);
  overflow: hidden;
  border: 1px solid rgba(74,67,57,.08);
  border-radius: 24px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.error-art {
  height: 220px;
  margin: 12px 12px 0;
  border-radius: 15px 15px 5px 5px;
  overflow: hidden;
}

.error-art img { width: 100%; height: 100%; display: block; object-fit: cover; }
.error-content { padding: 38px 32px 40px; }
.error-code { margin: 0 0 12px; color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .12em; }
.error-title { font-size: clamp(38px, 12vw, 54px); }
.error-link { min-height: 48px; margin-top: 26px; display: inline-flex; align-items: center; border-bottom: 1px solid currentColor; font-weight: 700; }

@media (max-width: 540px) {
  .error-page { padding: max(12px, env(safe-area-inset-top)) 10px max(12px, env(safe-area-inset-bottom)); }
  .error-art { height: 42vw; min-height: 170px; }
}

/* Legal pages */
.legal-page { background: var(--stage); }
.legal-card { width: min(100%, 510px); height: var(--portfolio-card-height); margin: auto; overflow: hidden; display: flex; flex-direction: column; border: 1px solid rgba(74,67,57,.08); border-radius: 22px; background: var(--card); box-shadow: var(--shadow); }
.legal-header { flex: 0 0 auto; padding: 20px 20px 18px; border-bottom: 1px solid var(--line); }
.back-link { min-height: 44px; display: inline-flex; align-items: center; color: rgba(74,67,57,.8); font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.legal-title { margin-top: 14px; font-size: clamp(32px, 9vw, 42px); }
.legal-intro { max-width: 480px; margin: 14px 0 0; color: var(--muted); font-family: Georgia, "Times New Roman", serif; font-size: 15px; line-height: 1.4; }
.legal-content { min-height: 0; flex: 1 1 auto; padding: 28px 20px 36px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: rgba(74,67,57,.28) transparent; }
.legal-content::-webkit-scrollbar { width: 5px; }
.legal-content::-webkit-scrollbar-thumb { border-radius: 999px; background: rgba(74,67,57,.28); }
.legal-content section + section { margin-top: 32px; }
.legal-content h2 { margin: 0 0 9px; font-family: Georgia, "Times New Roman", serif; font-size: 19px; line-height: 1.2; font-weight: 400; letter-spacing: -.015em; }
.legal-content p, .legal-content address, .legal-content li { color: rgba(74,67,57,.9); font-size: 14px; line-height: 1.65; }
.legal-content p, .legal-content address { margin: 0; }
.legal-content p + p { margin-top: 12px; }
.legal-content address { font-style: normal; }
.legal-content a { border-bottom: 1px solid var(--line); }
.legal-note { color: var(--muted) !important; }

@media (max-width: 350px) {
  :root { --portfolio-card-height: 650px; }
  .site-meta { flex-wrap: wrap; gap: 0 12px; padding-top: 5px; }
}

@media (min-width: 541px) {
  .legal-card { border-radius: 24px; }
  .legal-header { padding: 24px 38px 22px; }
  .legal-content { padding: 32px 38px 42px; }
}
