:root {
  color-scheme: light;
  --paper: #f5f6f2;
  --surface: #ffffff;
  --ink: #121411;
  --muted: #686d66;
  --line: #d8dcd4;
  --line-dark: #aeb5aa;
  --accent: #15945f;
  --accent-dark: #0d7247;
  --danger: #bd3e37;
  --shadow: 0 24px 70px rgba(29, 39, 31, 0.12);
  font-family:
    "Avenir Next", Avenir, "Segoe UI", Helvetica, Arial, sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  padding-right: env(safe-area-inset-right);
  padding-left: env(safe-area-inset-left);
  background: var(--paper);
  color: var(--ink);
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1380px, calc(100% - 56px));
  height: 76px;
  margin: 0 auto;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  gap: 11px;
  align-items: center;
  color: var(--ink);
  font-size: 17px;
  font-weight: 700;
  text-decoration: none;
}

.brand-mark {
  position: relative;
  display: inline-grid;
  grid-template-columns: repeat(2, 8px);
  gap: 3px;
  width: 21px;
  height: 21px;
  padding: 1px;
}

.brand-mark::before,
.brand-mark span {
  display: block;
  border: 2px solid currentColor;
  content: "";
}

.brand-mark::before {
  position: absolute;
  inset: 0;
}

.brand-mark span {
  align-self: end;
  height: 10px;
  border-top: 0;
}

.availability {
  display: inline-flex;
  gap: 9px;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 5px rgba(21, 148, 95, 0.12);
  animation: breathe 2.8s ease-in-out infinite;
}

main {
  overflow: hidden;
}

.workspace {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(520px, 1.4fr);
  grid-template-areas:
    "intro samples"
    "tool samples";
  gap: 48px 72px;
  width: min(1380px, calc(100% - 56px));
  min-height: calc(100dvh - 76px);
  margin: 0 auto;
  padding: clamp(68px, 9vh, 112px) 0 82px;
}

.intro {
  grid-area: intro;
  align-self: end;
  max-width: 610px;
}

.eyebrow {
  margin: 0 0 18px;
  color: var(--accent-dark);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
}

h1 {
  max-width: 680px;
  margin: 0;
  font-size: clamp(48px, 6.8vw, 96px);
  font-weight: 650;
  line-height: 0.94;
  letter-spacing: 0;
}

.lede {
  max-width: 550px;
  margin: 27px 0 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.55;
}

.tool {
  grid-area: tool;
  align-self: start;
}

form {
  position: relative;
}

label {
  display: block;
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 700;
}

.input-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px auto;
  align-items: center;
  min-height: 68px;
  padding: 8px;
  border: 1px solid var(--line-dark);
  border-radius: 7px;
  background: var(--surface);
  box-shadow: 0 10px 28px rgba(36, 45, 38, 0.07);
  transition:
    border-color 180ms ease,
    box-shadow 180ms ease;
}

.input-shell:focus-within {
  border-color: var(--ink);
  box-shadow:
    0 0 0 3px rgba(21, 148, 95, 0.12),
    0 16px 38px rgba(36, 45, 38, 0.09);
}

input {
  min-width: 0;
  height: 50px;
  padding: 0 13px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 15px;
}

input::placeholder {
  color: #999f96;
}

.icon-button,
.submit-button,
.download-button {
  border: 0;
  cursor: pointer;
  transition:
    transform 180ms cubic-bezier(0.16, 1, 0.3, 1),
    background-color 180ms ease,
    color 180ms ease;
}

.icon-button:active,
.submit-button:active,
.download-button:active {
  transform: translateY(1px) scale(0.98);
}

.icon-button {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
}

.icon-button:hover {
  background: #eef0ec;
  color: var(--ink);
}

.icon-button svg,
.submit-button svg,
.download-button svg,
.source-link svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.submit-button {
  display: inline-flex;
  gap: 13px;
  align-items: center;
  justify-content: center;
  height: 50px;
  padding: 0 20px;
  border-radius: 5px;
  background: var(--ink);
  color: white;
  font-size: 14px;
  font-weight: 700;
}

.submit-button:hover {
  background: var(--accent-dark);
}

.submit-button[disabled] {
  cursor: wait;
  opacity: 0.72;
}

.submit-button.is-loading svg {
  animation: nudge 1s ease-in-out infinite;
}

.form-message {
  min-height: 22px;
  margin: 10px 0 0;
  color: var(--danger);
  font-size: 13px;
  line-height: 1.45;
}

.form-message.is-success {
  color: var(--accent-dark);
}

.tool-footer {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.sample-strip {
  position: relative;
  grid-area: samples;
  align-self: stretch;
  min-height: 620px;
}

.sample {
  position: absolute;
  overflow: hidden;
  margin: 0;
  border: 8px solid var(--surface);
  border-radius: 7px;
  background: #dfe3dd;
  box-shadow: var(--shadow);
}

.sample img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sample-wide {
  top: 2%;
  right: 4%;
  width: 54%;
  height: 69%;
  transform: rotate(2.5deg);
}

.sample-square {
  bottom: 3%;
  left: 0;
  width: 48%;
  aspect-ratio: 1;
  transform: rotate(-3deg);
}

.sample-tall {
  right: 0;
  bottom: 0;
  width: 31%;
  height: 48%;
  transform: rotate(5deg);
}

.sample-caption {
  position: absolute;
  right: 16%;
  bottom: -24px;
  margin: 0;
  color: var(--muted);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 11px;
}

.results-section {
  width: min(1380px, calc(100% - 56px));
  margin: 0 auto;
  padding: 82px 0 110px;
  border-top: 1px solid var(--line);
}

.results-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 36px;
}

h2 {
  margin: 0;
  font-size: clamp(34px, 4vw, 58px);
  font-weight: 650;
  line-height: 1;
  letter-spacing: 0;
}

.source-link {
  display: inline-flex;
  gap: 9px;
  align-items: center;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--line-dark);
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.source-link:hover {
  color: var(--accent-dark);
}

.media-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 44px 24px;
}

.media-card {
  min-width: 0;
  animation: reveal 460ms cubic-bezier(0.16, 1, 0.3, 1) both;
  animation-delay: calc(var(--index, 0) * 70ms);
}

.media-frame {
  position: relative;
  overflow: hidden;
  aspect-ratio: 4 / 5;
  border-radius: 7px;
  background:
    linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, 0.58) 45%, transparent 60%),
    #e1e4de;
  background-size: 240% 100%;
  animation: shimmer 1.6s linear infinite;
}

.media-frame img,
.media-frame video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #171916;
}

.media-frame.is-loaded {
  animation: none;
  background: #171916;
}

.media-frame[data-error]::after {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #d5d8d2;
  font-size: 12px;
  content: attr(data-error);
}

.media-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0 0;
  border-top: 1px solid transparent;
}

.media-meta > div {
  display: flex;
  gap: 12px;
  align-items: center;
}

.media-index {
  color: var(--ink);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 11px;
  font-weight: 700;
}

.media-kind {
  color: var(--muted);
  font-size: 12px;
  text-transform: capitalize;
}

.download-button {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line-dark);
  border-radius: 5px;
  background: transparent;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

.download-button:hover {
  border-color: var(--ink);
  background: var(--ink);
  color: white;
}

.mobile-save-bar,
.save-sheet {
  display: none;
}

.save-sheet[hidden],
.mobile-save-bar[hidden] {
  display: none !important;
}

.save-sheet-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(18, 20, 17, 0.36);
  backdrop-filter: blur(4px);
}

.save-sheet-panel {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  max-height: min(88dvh, 760px);
  padding: 20px 16px calc(18px + env(safe-area-inset-bottom));
  overflow-y: auto;
  border-radius: 16px 16px 0 0;
  background: var(--paper);
  box-shadow: 0 -18px 60px rgba(18, 20, 17, 0.2);
  animation: sheet-in 260ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.save-sheet-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
}

.save-sheet-header h2 {
  font-size: 30px;
}

.sheet-close-button {
  display: grid;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink);
}

.sheet-close-button svg,
.mobile-save-button svg,
.sheet-primary-button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.save-sheet-media {
  overflow: hidden;
  margin-top: 20px;
  border-radius: 8px;
  background: #171916;
}

.save-sheet-media img,
.save-sheet-media video {
  display: block;
  width: 100%;
  max-height: 54dvh;
  object-fit: contain;
  -webkit-touch-callout: default;
}

.save-sheet-help {
  margin: 14px 2px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.save-sheet-actions {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 10px;
}

.sheet-primary-button,
.sheet-secondary-button,
.mobile-save-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}

.sheet-primary-button {
  gap: 9px;
  border: 0;
  background: var(--ink);
  color: white;
}

.sheet-primary-button:disabled {
  opacity: 0.48;
}

.sheet-secondary-button {
  border: 1px solid var(--line-dark);
  color: var(--ink);
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  width: min(1380px, calc(100% - 56px));
  margin: 0 auto;
  padding: 25px 0 32px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

@keyframes breathe {
  0%,
  100% {
    transform: scale(0.85);
    opacity: 0.72;
  }
  50% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes nudge {
  0%,
  100% {
    transform: translateX(0);
  }
  50% {
    transform: translateX(4px);
  }
}

@keyframes shimmer {
  from {
    background-position: 140% 0;
  }
  to {
    background-position: -80% 0;
  }
}

@keyframes reveal {
  from {
    transform: translateY(18px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes sheet-in {
  from {
    transform: translateY(24px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

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

@media (max-width: 980px) {
  .workspace {
    grid-template-columns: 1fr;
    grid-template-areas:
      "intro"
      "tool"
      "samples";
    gap: 36px;
    padding-top: 64px;
  }

  .intro {
    align-self: auto;
  }

  .sample-strip {
    min-height: 560px;
    margin-top: 8px;
  }

  .sample-wide {
    width: 56%;
  }
}

@media (max-width: 640px) {
  body {
    padding-top: env(safe-area-inset-top);
  }

  body.has-mobile-save {
    padding-bottom: calc(94px + env(safe-area-inset-bottom));
  }

  body.save-sheet-open {
    overflow: hidden;
  }

  .site-header,
  .workspace,
  .results-section,
  footer {
    width: calc(100% - 32px);
  }

  .site-header {
    height: 66px;
  }

  .workspace {
    min-height: auto;
    gap: 26px;
    padding: 38px 0 54px;
  }

  h1 {
    font-size: clamp(42px, 13vw, 58px);
  }

  .lede {
    margin-top: 21px;
    font-size: 15px;
  }

  .input-shell {
    grid-template-columns: minmax(0, 1fr) 44px;
    min-height: 64px;
  }

  input {
    font-size: 16px;
  }

  .submit-button {
    grid-column: 1 / -1;
    width: 100%;
    margin-top: 7px;
  }

  .tool-footer {
    display: grid;
    gap: 3px;
  }

  .sample-strip {
    display: none;
  }

  .sample {
    border-width: 6px;
  }

  .sample-wide {
    right: 1%;
    width: 58%;
    height: 68%;
  }

  .sample-square {
    width: 49%;
  }

  .sample-tall {
    width: 32%;
  }

  .sample-caption {
    display: none;
  }

  .results-section {
    padding: 48px 0 62px;
  }

  .results-heading {
    align-items: start;
  }

  .media-grid {
    grid-template-columns: 1fr;
    gap: 36px;
  }

  .media-frame {
    border-radius: 6px;
  }

  .download-button {
    min-height: 44px;
    padding: 0 16px;
  }

  .mobile-save-bar {
    position: fixed;
    right: 10px;
    bottom: calc(10px + env(safe-area-inset-bottom));
    left: 10px;
    z-index: 20;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    min-height: 72px;
    padding: 10px 10px 10px 15px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    background: rgba(18, 20, 17, 0.94);
    box-shadow: 0 18px 50px rgba(18, 20, 17, 0.28);
    color: white;
    backdrop-filter: blur(18px);
  }

  .mobile-save-copy {
    display: grid;
    min-width: 0;
    gap: 3px;
  }

  .mobile-save-copy strong,
  .mobile-save-copy span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-save-copy strong {
    font-size: 13px;
  }

  .mobile-save-copy span {
    color: rgba(255, 255, 255, 0.68);
    font-size: 11px;
  }

  .mobile-save-button {
    gap: 7px;
    min-width: 108px;
    min-height: 50px;
    padding: 0 14px;
    border: 0;
    background: white;
    color: var(--ink);
  }

  .mobile-save-button:disabled {
    opacity: 0.55;
  }

  .save-sheet {
    position: fixed;
    inset: 0;
    z-index: 30;
    display: block;
  }

  footer {
    display: grid;
    gap: 7px;
  }
}
