@font-face {
  font-family: "Montserrat 1OB";
  font-style: normal;
  font-weight: 900;
  src: url("../fonts/Montserrat-VariableFont_wght.ttf") format("truetype");
}

@font-face {
  font-family: "BuckeyeSans2 1OB";
  font-style: normal;
  font-weight: 400;
  src: url("../fonts/BuckeyeSans2-Regular.ttf") format("truetype");
}

:root {
  --dark-blue: #002147;
  --red: #c60c30;
  --silver: #a5acaf;
  --white: #ffffff;
  --blue: #035992;
  --beige: #e3ddc5;
  --bg: #010a16;
  --bg-soft: #041426;
  --panel: #061220;
  --panel-2: #f4f1e6;
  --ink: var(--white);
  --text: #eef3f7;
  --muted: var(--silver);
  --line: rgba(165, 172, 175, 0.2);
  --line-light: rgba(227, 221, 197, 0.5);
  --ice: #f6f8fa;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  scroll-behavior: smooth;
}

body {
  min-height: 100%;
  margin: 0;
  background:
    radial-gradient(circle at 16% 0%, rgba(3, 89, 146, 0.16), transparent 30rem),
    linear-gradient(145deg, #00050d 0%, var(--bg) 52%, #020d1d 100%);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: inherit;
}

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--line);
  background: rgba(0, 12, 28, 0.94);
  backdrop-filter: blur(12px);
}

.site-header__inner {
  width: min(1180px, calc(100% - 32px));
  min-height: 72px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  text-decoration: none;
}

.brand__mark {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
}

.brand__mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand__text {
  display: grid;
  gap: 1px;
  line-height: 1.1;
}

.brand__text strong {
  font-size: 15px;
  text-transform: uppercase;
}

.brand__text span {
  color: var(--muted);
  font-size: 12px;
}

.topnav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.nav-item {
  position: relative;
}

.nav-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #020b16;
  padding: 8px 12px;
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  transition: border-color 140ms ease, color 140ms ease, background 140ms ease;
}

.nav-item.is-open .nav-trigger,
.nav-item.is-active .nav-trigger,
.nav-trigger:hover {
  border-color: rgba(198, 12, 48, 0.72);
  color: var(--white);
}

.nav-trigger-caret {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-left: 3px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
  transition: transform 140ms ease;
}

.nav-item.is-open .nav-trigger-caret {
  transform: rotate(-135deg);
}

.nav-flyout {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 30;
  display: flex;
  min-width: 220px;
  flex-direction: column;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #061220;
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.4);
  padding: 10px 8px 8px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(4px);
  transition: opacity 140ms ease, transform 140ms ease;
}

.nav-item.is-open .nav-flyout {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.nav-flyout::before {
  position: absolute;
  top: -5px;
  right: 18px;
  width: 9px;
  height: 9px;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
  background: #061220;
  content: "";
  transform: rotate(45deg);
}

.nav-flyout-link {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  border-radius: 6px;
  padding: 9px 10px;
  color: var(--text);
  font-size: 14px;
  text-decoration: none;
  transition: background 140ms ease, color 140ms ease;
}

.nav-flyout-link:hover,
.nav-flyout-link:focus-visible {
  background: rgba(255, 255, 255, 0.08);
  color: var(--white);
}

.nav-flyout-link.active {
  background: rgba(198, 12, 48, 0.16);
  color: var(--white);
}

.layout {
  width: min(1400px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 40px;
}

.tool {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(6, 18, 32, 0.96);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.tool__header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--red);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(24px, 3vw, 36px);
  line-height: 1.05;
}

.tool__status {
  min-width: 96px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
  text-transform: uppercase;
}

.tool__dek {
  max-width: 720px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 15px;
  font-weight: 650;
  line-height: 1.45;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(290px, 360px) minmax(0, 1fr);
  gap: 0;
}

.controls {
  display: grid;
  align-content: start;
  gap: 14px;
  padding: 18px;
  border-right: 1px solid var(--line);
  background: rgba(2, 10, 20, 0.62);
}

.dropzone {
  display: grid;
  gap: 9px;
  min-width: 0;
  min-height: 114px;
  border: 1px dashed rgba(233, 243, 248, 0.32);
  border-radius: 8px;
  padding: 16px;
  place-items: center;
  text-align: center;
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease;
}

.dropzone.is-dragging,
.dropzone:hover {
  border-color: var(--red);
  background: rgba(198, 12, 48, 0.1);
}

.dropzone input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.dropzone__button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border-radius: 6px;
  padding: 0 13px;
  background: var(--red);
  color: var(--white);
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

.dropzone__file {
  width: 100%;
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.field label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.field label span {
  color: var(--text);
  font-weight: 800;
  text-transform: none;
}

select,
input[type="text"],
textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #020b16;
  color: var(--ink);
  outline: none;
}

select {
  appearance: none;
  border-color: rgba(165, 172, 175, 0.14);
  border-radius: 8px;
  background-color: #20242b;
  background-image:
    linear-gradient(45deg, transparent 50%, #d6d9de 50%),
    linear-gradient(135deg, #d6d9de 50%, transparent 50%);
  background-position:
    calc(100% - 16px) 50%,
    calc(100% - 11px) 50%;
  background-repeat: no-repeat;
  background-size: 5px 5px, 5px 5px;
  color: var(--text);
  font-size: 12px;
  font-weight: 400;
  transition: background-color 140ms ease, border-color 140ms ease;
}

select option {
  font-size: 12px;
  font-weight: 400;
}

select:hover {
  border-color: rgba(165, 172, 175, 0.28);
  background-color: #252a32;
}

select:disabled,
button:disabled {
  cursor: not-allowed;
}

select:disabled {
  color: var(--text);
  opacity: 1;
}

input::placeholder,
textarea::placeholder {
  color: rgba(165, 172, 175, 0.7);
}

select,
input[type="text"] {
  min-height: 42px;
  padding: 0 11px;
}

select {
  min-height: 36px;
  padding: 0 30px 0 10px;
}

textarea {
  min-height: 76px;
  resize: vertical;
  padding: 10px 11px;
  line-height: 1.4;
}

select:focus-visible,
input:focus-visible,
textarea:focus-visible,
button:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--red);
}

.range-grid {
  display: grid;
  gap: 12px;
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding-top: 4px;
}

.template-builder .actions {
  grid-template-columns: 1fr;
}

.is-hidden {
  display: none !important;
}

.button,
.icon-button {
  border: 0;
  cursor: pointer;
}

.button {
  min-height: 42px;
  border-radius: 6px;
  padding: 0 14px;
  background: var(--red);
  color: var(--white);
  font-size: 13px;
  font-weight: 950;
  text-transform: uppercase;
}

.button:disabled,
.icon-button:disabled {
  background: #24282f;
  color: #636363;
  cursor: not-allowed;
  opacity: 1;
}

.button--secondary {
  border: 1px solid var(--line);
  background: #032d4f;
  color: var(--ice);
}

.preview {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 14px;
  padding: 18px;
}

.preview__toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.preview__toolbar div {
  display: grid;
  gap: 3px;
}

.preview__label {
  color: var(--red);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.preview__toolbar strong {
  color: var(--text);
  font-size: 13px;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 62px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #032d4f;
  color: var(--ice);
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
}

.canvas-frame {
  display: grid;
  place-items: center;
  min-height: 360px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(45deg, rgba(255, 255, 255, 0.035) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(255, 255, 255, 0.035) 25%, transparent 25%),
    #020813;
  background-size: 22px 22px;
  padding: 18px;
}

.canvas-frame--portrait {
  min-height: 640px;
}

.canvas-frame--portrait canvas {
  max-width: min(430px, 100%);
}

canvas {
  display: block;
  width: 100%;
  max-width: 780px;
  height: auto;
  border-radius: 6px;
  background: var(--dark-blue);
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.32);
}

.filename {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.template-builder__header {
  align-items: start;
}

.template-builder__header h1 {
  font-size: clamp(18px, 2.25vw, 27px);
}

.template-builder__body {
  display: grid;
  gap: 28px;
  min-width: 0;
  padding: 20px;
}

.template-rail {
  display: grid;
  grid-template-columns: minmax(220px, 300px) minmax(0, 1fr);
  gap: 28px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: rgba(1, 10, 22, 0.42);
}

.template-rail__summary {
  display: grid;
  align-content: center;
  gap: 2px;
  min-width: 0;
}

.template-rail__summary span {
  color: rgba(165, 172, 175, 0.86);
  font-size: 12px;
  font-weight: 950;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.template-rail__summary strong {
  color: var(--white);
  font-size: 20px;
  line-height: 1.1;
}

.template-rail__summary p {
  margin: 1px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
}

.template-grid {
  display: grid;
  grid-template-columns: minmax(250px, 330px) minmax(420px, 1fr) minmax(250px, 320px);
  gap: 18px;
  align-items: start;
  min-width: 0;
}

.template-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(2, 10, 20, 0.5);
}

.template-controls,
.template-preview,
.template-export {
  display: grid;
  gap: 18px;
  padding: 18px;
}

.template-controls textarea {
  font-size: 13px;
  line-height: 1.35;
}

.template-controls #deckInput {
  font-size: 13px;
}

.template-controls #accentInput {
  min-height: 52px;
}

.template-panel h2 {
  margin: 0;
  color: var(--text);
  font-size: 18px;
  line-height: 1.1;
}

.template-panel__section {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.template-dropzone {
  gap: 4px;
  min-height: 112px;
  padding: 12px;
  background: rgba(2, 8, 19, 0.74);
}

.template-dropzone .dropzone__button {
  background: rgba(165, 172, 175, 0.2);
  text-transform: none;
}

.template-reset {
  width: 100%;
  height: 42px;
}

.photo-adjustments {
  display: grid;
  gap: 18px;
}

.template-preview__header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
}

.template-preview__header div {
  display: grid;
  gap: 4px;
}

.template-preview__header span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.template-preview__header h2 {
  font-size: 22px;
}

.size-pill {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  border: 1px solid rgba(198, 12, 48, 0.76);
  border-radius: 999px;
  padding: 0 16px;
  color: var(--red) !important;
  background: rgba(198, 12, 48, 0.08);
  white-space: nowrap;
}

.template-canvas-frame {
  min-height: 700px;
  align-items: start;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
}

.template-canvas-frame canvas {
  width: min(100%, 560px);
  max-width: 560px;
  box-shadow: none;
}

.template-canvas-frame.has-image canvas {
  cursor: grab;
  touch-action: none;
}

.template-canvas-frame.is-dragging canvas {
  cursor: grabbing;
}

.template-export {
  gap: 22px;
}

.template-export__actions {
  grid-template-columns: 1fr;
  padding: 2px 0 0;
}

.template-output-card {
  display: grid;
  gap: 3px;
  border: 1px solid rgba(165, 172, 175, 0.14);
  border-radius: 8px;
  padding: 13px 14px;
  background: rgba(0, 18, 28, 0.86);
}

.template-output-card strong {
  color: var(--white);
  font-size: 16px;
}

.template-output-card span {
  color: var(--muted);
  font-size: 13px;
}

.template-output-card code {
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.footer {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 18px 0 28px;
  color: var(--muted);
  font-size: 12px;
}

.footer a {
  color: var(--beige);
  text-decoration: none;
}

@media (max-width: 860px) {
  .site-header__inner {
    align-items: flex-start;
    flex-direction: column;
    padding: 12px 0;
  }

  .topnav {
    width: 100%;
  }

  .nav-flyout {
    right: auto;
    left: 0;
    max-width: calc(100vw - 32px);
  }

  .nav-flyout::before {
    right: auto;
    left: 18px;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .controls {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .tool__header {
    align-items: start;
    flex-direction: column;
  }

  .template-builder__body {
    padding: 14px;
  }

  .template-rail,
  .template-grid {
    grid-template-columns: 1fr;
  }

  .template-canvas-frame {
    min-height: 520px;
  }
}

@media (max-width: 560px) {
  .site-header__inner,
  .layout,
  .footer {
    width: min(100% - 20px, 1180px);
  }

  .actions {
    grid-template-columns: 1fr;
  }

  .canvas-frame {
    min-height: 220px;
    padding: 10px;
  }

  .canvas-frame--portrait {
    min-height: 420px;
  }

  .template-builder__body {
    gap: 16px;
    padding: 10px;
  }

  .template-controls,
  .template-preview,
  .template-export {
    padding: 14px;
  }

  .template-canvas-frame {
    min-height: 420px;
    padding: 8px;
  }

  .template-preview__header {
    flex-direction: column;
  }
}
