/* Anand Nilayam Certificate Maker — web edition */
@font-face { font-family: "Garamond"; src: url("assets/fonts/EBGaramond-SemiBold.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: block; }
@font-face { font-family: "Garamond"; src: url("assets/fonts/EBGaramond-Italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: block; }
@font-face { font-family: "Cinzel"; src: url("assets/fonts/Cinzel-Bold.woff2") format("woff2"); font-weight: 700; font-display: block; }
@font-face { font-family: "Lato"; src: url("assets/fonts/Lato-Bold.woff2") format("woff2"); font-weight: 700; font-display: block; }
@font-face { font-family: "GreatVibes"; src: url("assets/fonts/GreatVibes-Regular.woff2") format("woff2"); font-display: block; }
@font-face { font-family: "Parisienne"; src: url("assets/fonts/Parisienne-Regular.woff2") format("woff2"); font-display: block; }
@font-face { font-family: "DancingScript"; src: url("assets/fonts/DancingScript-SemiBold.woff2") format("woff2"); font-display: block; }
@font-face { font-family: "Sacramento"; src: url("assets/fonts/Sacramento-Regular.woff2") format("woff2"); font-display: block; }
@font-face { font-family: "Tangerine"; src: url("assets/fonts/Tangerine-Bold.woff2") format("woff2"); font-display: block; }
@font-face { font-family: "PlayfairDisplay"; src: url("assets/fonts/PlayfairDisplay-SemiBold.woff2") format("woff2"); font-display: block; }
@font-face { font-family: "CormorantGaramond"; src: url("assets/fonts/CormorantGaramond-SemiBold.woff2") format("woff2"); font-display: block; }
@font-face { font-family: "Marcellus"; src: url("assets/fonts/Marcellus-Regular.woff2") format("woff2"); font-display: block; }

:root {
  --bg: #eef0f5;
  --card: #ffffff;
  --border: #e2e6ee;
  --navy: #0a1a50;
  --navy-dark: #061038;
  --gold: #ffb502;
  --gold-dark: #e8a400;
  --green: #136b3c;
  --text: #1b2338;
  --muted: #79839b;
  --credit: #94a3c7;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  display: flex; flex-direction: column; height: 100dvh; overflow: hidden;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 "Segoe UI", system-ui, -apple-system, sans-serif;
}

/* ------------------------------------------------------------- title bar */
.bar {
  flex: none; display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 10px 20px; background: var(--navy); color: #fff;
}
.bar-left { display: flex; align-items: center; gap: 12px; }
.bar-logo { width: 42px; height: 42px; object-fit: contain; }
.bar-title { font-size: 20px; font-weight: 700; letter-spacing: .02em; }
.bar-subtitle { font-size: 13px; color: var(--gold); }
.bar-credit { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; text-decoration: none; }
.bar-credit img { height: 24px; }
.bar-credit span { font-size: 11.5px; color: var(--credit); }
.bar-credit:hover span { color: #fff; }

/* ----------------------------------------------------------------- layout */
main {
  flex: 1; min-height: 0;
  display: grid; grid-template-columns: minmax(300px, 380px) 1fr;
  gap: 16px; padding: 14px 18px 18px; width: 100%; max-width: 1180px; margin: 0 auto;
}
.card {
  min-height: 0; background: var(--card); border: 1px solid var(--border);
  border-radius: 10px; padding: 16px 18px;
}
.form { overflow: auto; }   /* only scrolls on a very short window */
.section {
  display: flex; align-items: center; gap: 12px; margin: 0 0 9px;
  font-size: 15px; font-weight: 700; color: var(--navy);
}
.section::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.section.plain::after { content: none; }
.form .section:not(:first-child) { margin-top: 14px; }

.field-label {
  display: block; margin-bottom: 3px;
  font-size: 12.5px; font-weight: 600; color: var(--muted);
}
input[type="text"], input[type="date"], select {
  width: 100%; margin-bottom: 9px; padding: 8px 11px;
  font: inherit; color: var(--text); background: #fff;
  border: 1px solid var(--border); border-radius: 7px;
}
input:focus, select:focus { outline: none; border-color: var(--navy); }

.disclosure {
  display: flex; align-items: center; gap: 8px; width: 100%; margin: 2px 0 0; padding: 4px 0;
  font: inherit; font-size: 15px; font-weight: 700; color: var(--navy);
  background: none; border: 0; cursor: pointer;
}
.disclosure .arrow { transition: transform .12s ease; }
.disclosure[aria-expanded="true"] .arrow { transform: rotate(90deg); }
.extras { padding-top: 8px; }

.segmented { display: flex; gap: 8px; margin-bottom: 8px; }
.segmented button {
  flex: 1; padding: 9px 0; font: inherit; font-size: 13px; color: var(--muted);
  background: #fff; border: 1px solid var(--border); border-radius: 999px; cursor: pointer;
}
.segmented button[aria-checked="true"] { background: var(--navy); border-color: var(--navy); color: #fff; }
.hint { margin: 2px 0 0; font-size: 11.5px; color: var(--muted); }

/* ---------------------------------------------------------------- preview */
.preview { display: flex; flex-direction: column; align-items: center; }
.preview-head { display: flex; align-items: baseline; justify-content: space-between; width: 100%; }
.sheet {
  flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center;
  width: 100%; padding: 8px 0;
}
#preview {
  display: block; max-height: 100%; max-width: 100%; width: auto; height: auto;
  border-radius: 3px; box-shadow: 0 2px 10px rgba(16, 24, 48, .18);
}
.generate {
  flex: none; margin: 10px 0 0; padding: 12px 30px; font: inherit; font-size: 16px; font-weight: 700;
  color: var(--navy); background: var(--gold); border: 0; border-radius: 999px; cursor: pointer;
}
.generate:hover { background: var(--gold-dark); }
.generate:disabled { opacity: .55; cursor: default; }
.status { min-height: 16px; margin: 8px 0 0; font-size: 12.5px; color: var(--green); }

/* ----------------------------------------------------------------- modal */
.modal {
  position: fixed; inset: 0; display: grid; place-items: center;
  background: rgba(12, 18, 40, .45);
}
.modal[hidden] { display: none; }   /* the attribute alone loses to display: grid */
.extras[hidden] { display: none; }
.modal-card {
  width: min(420px, 90vw); padding: 26px; background: #fff; border-radius: 12px;
  box-shadow: 0 20px 50px rgba(10, 20, 50, .3);
}
.tick {
  display: grid; place-items: center; width: 44px; height: 44px; margin-bottom: 12px;
  font-size: 22px; color: var(--green); background: #e8f5ec; border-radius: 50%;
}
.modal-card h3 { margin: 0 0 6px; font-size: 19px; }
.filename { margin: 0; font-weight: 600; word-break: break-all; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.modal-actions .ghost, .modal-actions .primary {
  padding: 10px 22px; font: inherit; font-size: 14px; border-radius: 999px; cursor: pointer; text-decoration: none;
}
.modal-actions .ghost { color: #fff; background: var(--navy); border: 0; }
.modal-actions .primary { color: var(--navy); background: var(--gold); border: 0; }

/* Narrow or short windows: let the page scroll rather than squeeze. */
@media (max-width: 860px), (max-height: 560px) {
  body { height: auto; min-height: 100dvh; overflow: auto; }
  main { grid-template-columns: 1fr; }
  .form { overflow: visible; }
  .sheet { min-height: 0; }
}

/* Phones and small tablets: sheet first, form under it, action always reachable. */
@media (max-width: 860px) {
  .bar { flex-direction: row; align-items: center; padding: 8px 14px; gap: 10px; }
  .bar-logo { width: 34px; height: 34px; }
  .bar-title { font-size: 16px; }
  .bar-subtitle { font-size: 11.5px; }
  .bar-credit { align-items: flex-end; gap: 2px; }
  .bar-credit img { height: 17px; }
  .bar-credit span { font-size: 10px; }

  main { padding: 12px 12px 78px; gap: 12px; }   /* room for the fixed action */
  .card { padding: 14px; }
  .preview { order: -1; }
  .sheet { padding: 6px 0 0; }
  #preview { max-height: 52vh; }
  .status { min-height: 0; }

  .generate {
    position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 5;
    margin: 0; padding: 15px 0; font-size: 17px;
    box-shadow: 0 6px 20px rgba(16, 24, 48, .25);
  }
  .modal-card { padding: 20px; }
}

/* Landscape phone: too short to stack, wide enough for two columns. */
@media (max-width: 860px) and (min-width: 640px) and (max-height: 560px) {
  main { grid-template-columns: minmax(260px, 45%) 1fr; }
  .preview { order: 0; }
  #preview { max-height: 72vh; }
}

@media (max-width: 420px) {
  .bar-credit span { display: none; }            /* the wordmark alone at this width */
  .section { font-size: 14px; }
  #preview { max-height: 48vh; }
}
