@font-face {
  font-family: "Euclauvic Standard";
  src: url("./fonts/Euclauvic-Standard.woff") format("woff");
  font-display: swap;
}

@font-face {
  font-family: "Euclauvic Declarative";
  src: url("./fonts/Euclauvic-Declarative.woff") format("woff");
  font-display: swap;
}

:root {
  --paper: #f5f0e6;
  --paper-light: #fffdf7;
  --ink: #12241f;
  --muted: #617069;
  --line: #c8c7b9;
  --green: #173d32;
  --green-soft: #dce8df;
  --orange: #e36b3d;
  --shadow: 0 18px 60px rgba(25, 48, 39, 0.1);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--paper); }

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 4%, rgba(227, 107, 61, 0.08), transparent 27rem),
    linear-gradient(rgba(18, 36, 31, 0.025) 1px, transparent 1px),
    var(--paper);
  background-size: auto, 100% 32px, auto;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, textarea { font: inherit; }
button { color: inherit; }
.page-shell { min-height: 100vh; }

.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 22px clamp(20px, 5vw, 72px);
  color: #f7f2e7;
  background: var(--green);
  border-bottom: 4px solid var(--orange);
}

.brand { display: flex; align-items: center; gap: 14px; }
.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  font-size: 27px;
}
.brand-name { margin: 0; font-size: 15px; font-weight: 760; letter-spacing: 0.2em; }
.brand-sub { margin: 3px 0 0; color: #b9cec5; font-size: 12px; }
.masthead-note { color: #b9cec5; font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; }

main { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 72px 0 56px; }
.intro { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(260px, 0.65fr); gap: 54px; align-items: end; }
.eyebrow { margin: 0 0 14px; color: var(--orange); font-size: 12px; font-weight: 800; letter-spacing: 0.18em; text-transform: uppercase; }
h1 { max-width: 760px; margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(44px, 7vw, 82px); font-weight: 500; line-height: 0.98; letter-spacing: -0.045em; }
.intro-copy { margin: 0; color: var(--muted); font-size: 16px; line-height: 1.65; }

.workspace { margin-top: 54px; padding: clamp(20px, 3.5vw, 38px); background: var(--paper-light); border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--shadow); }
.workspace-top { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.style-switch { display: flex; gap: 6px; padding: 5px; background: #e8e8de; border-radius: 999px; }
.style-button { min-width: 150px; padding: 10px 18px; border: 0; border-radius: 999px; background: transparent; cursor: pointer; font-size: 13px; font-weight: 750; }
.style-button span { display: block; margin-top: 2px; color: var(--muted); font-size: 10px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; }
.style-button.active { color: white; background: var(--green); }
.style-button.active span { color: #b9cec5; }
.direction-switch { display: flex; align-items: center; gap: 10px; padding: 9px 14px; border: 1px solid var(--line); border-radius: 10px; background: transparent; cursor: pointer; font-size: 12px; font-weight: 750; letter-spacing: 0.04em; }
.direction-switch:hover, .secondary-button:hover { border-color: var(--green); background: var(--green-soft); }
.swap-icon { color: var(--orange); font-size: 18px; }

.translator-grid { display: grid; grid-template-columns: minmax(0, 1fr) 48px minmax(0, 1fr); gap: 20px; align-items: stretch; }
.panel { display: flex; min-width: 0; min-height: 330px; flex-direction: column; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; background: white; }
.panel.output { background: #f1f4ef; }
.panel-head { display: flex; align-items: center; justify-content: space-between; min-height: 54px; padding: 0 18px; border-bottom: 1px solid var(--line); }
.panel-label { font-size: 12px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; }
.panel-actions { display: flex; gap: 4px; }
.text-button { padding: 7px 9px; border: 0; border-radius: 7px; background: transparent; cursor: pointer; color: var(--muted); font-size: 12px; font-weight: 700; }
.text-button:hover { color: var(--ink); background: #eeeae0; }
.image-action { color: white; background: var(--orange); }
.image-action:hover { color: white; background: #c9542b; }
.editor {
  width: 100%;
  min-height: 250px;
  flex: 1;
  resize: vertical;
  padding: 24px;
  color: var(--ink);
  background: transparent;
  border: 0;
  outline: 0;
  font-size: 25px;
  line-height: 1.55;
}
.editor::placeholder { color: #9ba39e; }
.editor.euclauvic { font-size: 34px; letter-spacing: 0.03em; }
.standard-script { font-family: "Euclauvic Standard", sans-serif; }
.declarative-script { font-family: "Euclauvic Declarative", sans-serif; }
.counter { padding: 0 18px 14px; color: #89938e; font-size: 11px; text-align: right; }
.center-swap { display: grid; place-items: center; }
.round-button { display: grid; width: 42px; height: 42px; place-items: center; border: 1px solid var(--line); border-radius: 50%; background: var(--paper-light); cursor: pointer; color: var(--orange); font-size: 20px; }
.round-button:hover { color: white; border-color: var(--orange); background: var(--orange); }
.status-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 34px; margin-top: 16px; color: var(--muted); font-size: 12px; }
.status { color: var(--green); font-weight: 700; }
.caution { max-width: 700px; }

.reference { margin-top: 56px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.section-heading h2 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: 30px; font-weight: 500; }
.section-heading p { margin: 0; color: var(--muted); font-size: 13px; }
.alphabet-grid { display: grid; grid-template-columns: repeat(13, minmax(48px, 1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); background: var(--paper-light); }
.letter-card { min-height: 92px; display: grid; place-items: center; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.latin-letter { color: var(--orange); font-size: 11px; font-weight: 800; }
.euclauvic-letter { font-size: 30px; line-height: 1; }

.footer { display: flex; justify-content: space-between; gap: 20px; padding: 28px clamp(20px, 5vw, 72px); color: #9bb0a7; background: #0d2921; font-size: 12px; }

@media (max-width: 860px) {
  .masthead-note { display: none; }
  main { padding-top: 50px; }
  .intro { grid-template-columns: 1fr; gap: 24px; }
  .workspace-top { align-items: stretch; flex-direction: column; }
  .style-switch { align-self: flex-start; }
  .direction-switch { justify-content: center; }
  .translator-grid { grid-template-columns: 1fr; }
  .center-swap { height: 28px; }
  .round-button { transform: rotate(90deg); }
  .alphabet-grid { grid-template-columns: repeat(7, 1fr); }
}

@media (max-width: 520px) {
  .masthead { padding: 16px 18px; }
  .brand-mark { width: 38px; height: 38px; }
  main { width: min(100% - 24px, 1180px); padding-top: 36px; }
  h1 { font-size: 42px; }
  .workspace { margin-top: 36px; padding: 14px; border-radius: 18px; }
  .style-switch { display: grid; width: 100%; grid-template-columns: 1fr 1fr; }
  .style-button { min-width: 0; padding-inline: 10px; }
  .panel { min-height: 280px; }
  .editor { min-height: 210px; padding: 18px; font-size: 20px; }
  .editor.euclauvic { font-size: 30px; }
  .status-row, .section-heading, .footer { align-items: flex-start; flex-direction: column; }
  .alphabet-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (prefers-reduced-motion: no-preference) {
  button { transition: background-color 160ms ease, color 160ms ease, border-color 160ms ease, transform 160ms ease; }
}
