* { box-sizing: border-box; }
:root {
  color-scheme: light;
  --white: #fff;
  --paper: #f8f8f8;
  --ink: #0c2634;
  --muted: #505b65;
  --line: #dce4e9;
  --blue: #0066aa;
  --sky: #40b8f4;
  --orange: #ff4500;
  --red: #ff1844;
  --heading: Poppins, Inter, sans-serif;
  --body: Inter, sans-serif;
  --shadow: 0 .55rem 1.7rem rgb(12 38 52 / 9%);
}
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--white); color: var(--ink); font: 1rem/1.6 var(--body); }
body:has(dialog[open]) { overflow: hidden; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 4px; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { font-family: var(--heading); line-height: 1.14; }
h2 { font-size: clamp(1.85rem, 4vw, 2.85rem); font-weight: 700; letter-spacing: -.035em; }
.wrap { width: min(100% - 2rem, 72rem); margin-inline: auto; }
.sr-only, .skip:not(:focus) { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; z-index: 2; background: var(--white); padding: .75rem; }
.header { padding-top: .85rem; }
.header-inner { display: flex; flex-wrap: wrap; align-items: center; gap: 0 .85rem; padding: .55rem .85rem; border-radius: 1.05rem; background: var(--white); box-shadow: var(--shadow); }
.brand { display: inline-flex; align-items: center; gap: .65rem; min-height: 2.75rem; color: var(--ink); font-weight: 700; text-decoration: none; white-space: nowrap; }
.brand img { display: block; width: 4rem; height: auto; }
.brand span { border-left: 1px solid var(--line); padding-left: .65rem; }
nav { display: flex; gap: .8rem; margin-left: auto; }
nav a, .header-cta { display: inline-flex; align-items: center; min-height: 2.75rem; font-size: .875rem; font-weight: 700; text-decoration: none; }
nav a:hover { color: var(--blue); text-decoration: underline; text-underline-offset: .25rem; }
.header-cta { display: none; gap: .5rem; padding-inline: .95rem; border-radius: .75rem; color: var(--ink); background: linear-gradient(110deg, #50b6f7, #42c5f5); }
.header-cta:hover { background: #80d5fa; }
.hero { position: relative; isolation: isolate; overflow: hidden; padding: 3.1rem 0 1.65rem; text-align: center; }
.hero::after { content: ""; position: absolute; z-index: -1; inset: auto 0 0; height: clamp(1.2rem, 4vw, 2.8rem); background: var(--blue); clip-path: polygon(0 0, 10% 34%, 20% 63%, 30% 84%, 40% 96%, 50% 100%, 60% 96%, 70% 84%, 80% 63%, 90% 34%, 100% 0, 100% 100%, 0 100%); }
.hero h1 { max-width: 17ch; margin-inline: auto; font-size: clamp(2.2rem, 6.15vw, 4.9rem); line-height: 1.04; font-weight: 700; letter-spacing: -.042em; text-transform: uppercase; }
.hero-break { display: none; }
.hero-copy > p { max-width: 44ch; margin: 1rem auto 1.15rem; color: var(--muted); font-size: clamp(1rem, 2vw, 1.23rem); }
.hero-art { display: block; width: min(100%, 45rem); height: auto; margin: 1.25rem auto .65rem; }
.button { display: inline-flex; gap: .55rem; align-items: center; justify-content: center; min-height: 2.75rem; padding: .6rem 1.1rem; border: 1px solid transparent; border-radius: 1.6rem; font-size: .875rem; font-weight: 700; text-decoration: none; }
.primary { color: var(--ink); background: var(--orange); }
.primary:hover { background: #ff702f; }
.hero .button { text-transform: uppercase; padding-inline: 1.4rem; }
.secondary { border-color: var(--line); background: var(--white); color: var(--blue); }
.secondary:hover { background: #eaf5fc; }
.library { background: var(--paper); }
.library-top { background: var(--blue); color: var(--white); padding: 1.8rem 0 1.15rem; }
.section-heading { display: grid; gap: 1rem; align-items: end; }
.section-heading p { margin-top: .35rem; color: #e3f3ff; }
.search { display: flex; align-items: center; min-width: 0; gap: .75rem; padding-inline: .95rem; border-radius: .65rem; background: var(--white); color: var(--ink); }
.search:focus-within { outline: 2px solid var(--white); outline-offset: 3px; }
.search input { outline: none; width: 100%; min-height: 2.85rem; border: 0; padding: 0; color: var(--ink); background: transparent; }
.search-icon { display: inline-block; position: relative; flex: 0 0 .78rem; width: .78rem; height: .78rem; border: 1.5px solid var(--blue); border-radius: 50%; }
.search-icon::after { content: ""; position: absolute; right: -.27rem; bottom: -.11rem; width: .35rem; height: 1.5px; background: var(--blue); transform: rotate(45deg); }
.filters { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; }
.filter { min-height: 2.75rem; padding: .4rem .85rem; border: 1px solid #a4d2ed; border-radius: 2rem; color: var(--white); background: transparent; font-size: .86rem; font-weight: 700; }
.filter:hover { background: #075889; }
.filter:focus-visible { outline-color: var(--white); }
.filter[aria-pressed="true"] { color: #005b97; background: var(--white); border-color: var(--white); }
.library-content { padding-block: 1.05rem 3.4rem; }
.results { margin-bottom: .8rem; color: var(--muted); font-size: .875rem; }
.cards { display: grid; gap: .95rem; }
.card { min-width: 0; border: 1px solid var(--line); border-radius: .95rem; background: var(--white); box-shadow: 0 .35rem 1rem rgb(12 38 52 / 5%); }
.card-button { display: flex; flex-direction: column; align-items: start; gap: .6rem; width: 100%; height: 100%; padding: 1.2rem; border: 0; border-radius: inherit; background: transparent; color: inherit; text-align: start; }
.card-button:hover { background: #f4faff; }
.card-type { display: flex; gap: .5rem; align-items: center; color: #005b97; font-size: .82rem; font-weight: 700; }
.card-type[data-group="floral"] { color: #a81937; }
.card-type[data-group="full"] { color: #9c380e; }
.card-icon { display: inline-grid; place-items: center; width: 1.75rem; height: 1.75rem; border-radius: .5rem; background: #e3f4ff; font-size: 1rem; }
[data-group="floral"] .card-icon { background: #ffe9ee; }
[data-group="full"] .card-icon { background: #fff0e9; }
.card-title { font: 600 1.22rem/1.25 var(--heading); letter-spacing: -.025em; }
.card-description { margin-bottom: .35rem; color: var(--muted); font-size: .94rem; }
.card-link { margin-top: auto; color: var(--blue); font-size: .88rem; font-weight: 700; }
.card-link span { margin-left: .3rem; }
.how { padding-block: 2.8rem 3.2rem; }
.steps { display: grid; gap: 1rem; padding: 0; margin: 1.2rem 0 0; list-style: none; }
.steps li { padding: 1.1rem 1.2rem; border-left: .23rem solid var(--orange); border-radius: .5rem; background: var(--paper); }
.steps h3 { margin-bottom: .35rem; font-size: 1.08rem; font-weight: 600; }
.steps p { max-width: 39ch; color: var(--muted); font-size: .93rem; }
.footer { padding-block: 1.35rem; color: var(--white); background: #01182b; font-size: .875rem; font-weight: 600; }
.footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem 1rem; }
.footer a { color: #a6e0ff; text-decoration: none; }
.footer a:hover { text-decoration: underline; }
.footer a:focus-visible { outline-color: #a6e0ff; }
.editor { width: min(100% - 1rem, 67rem); max-height: 92dvh; padding: 0; border: 1px solid var(--line); border-radius: 1rem; background: var(--white); color: var(--ink); box-shadow: 0 1rem 4rem #01182b40; }
.editor::backdrop { background: #01182b9c; }
.editor-header { position: sticky; top: 0; z-index: 1; display: flex; align-items: start; justify-content: space-between; gap: .5rem; padding: .95rem 1.05rem; border-bottom: 1px solid var(--line); background: var(--white); }
.editor-header h2 { margin-top: .25rem; font-size: clamp(1.55rem, 4vw, 2.4rem); }
.eyebrow { color: var(--blue); font-size: .8rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; }
.icon-button { display: inline-grid; flex: 0 0 auto; place-items: center; width: 2.75rem; height: 2.75rem; border: 1px solid var(--line); border-radius: 50%; background: var(--paper); color: var(--ink); font-size: 1.65rem; line-height: 1; }
.icon-button:hover { background: #eaf5fc; }
.editor-grid { display: grid; gap: 1rem; padding: 1rem 1.05rem 1.3rem; }
#prompt-form, .preview { min-width: 0; }
#editor-description, .field small { color: var(--muted); }
.reference-note { padding: .75rem; margin-block: .8rem; border-radius: .55rem; background: #eaf5fc; font-size: .9rem; }
.field { display: grid; gap: .25rem; margin-top: .8rem; }
.field label { font-size: .9rem; font-weight: 700; }
.field .badge { margin-left: .45rem; color: #005b97; font-size: .8rem; font-weight: 600; }
.field input { min-width: 0; min-height: 2.75rem; padding: .55rem .65rem; border: 1px solid #aebfcb; border-radius: .45rem; background: var(--white); color: var(--ink); }
.field small { font-size: .85rem; overflow-wrap: anywhere; }
.preview { display: flex; flex-direction: column; align-self: start; gap: .65rem; padding: .85rem; border: 1px solid var(--line); border-radius: .75rem; background: var(--paper); }
.preview h3, .uploader-heading h3, .generated-heading h3 { font-size: 1.1rem; font-weight: 600; }
#output { display: block; width: 100%; min-height: 15rem; resize: vertical; padding: .75rem; border: 1px solid var(--line); border-radius: .45rem; background: var(--white); color: var(--ink); font: .875rem/1.6 var(--body); }
.preview-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .75rem; }
#copy-status, #generation-status { color: var(--muted); font-size: .875rem; }
.reference-uploader { margin-top: 1.1rem; padding: .85rem; border: 1px solid var(--line); border-radius: .75rem; }
.uploader-heading, .generated-heading { display: flex; align-items: start; justify-content: space-between; gap: .75rem; }
.uploader-heading p { margin-top: .3rem; color: var(--muted); font-size: .875rem; }
.photo-count { padding: .22rem .5rem; border-radius: 2rem; background: #eaf5fc; color: #005b97; font-size: .8rem; font-weight: 700; white-space: nowrap; }
.drop-zone { display: grid; justify-items: center; gap: .35rem; margin-top: .8rem; padding: 1rem .65rem; border: 1px dashed #7fa4bb; border-radius: .6rem; background: #f6fbff; color: var(--muted); text-align: center; font-size: .85rem; }
.drop-zone.dragover { background: #e2f3ff; border-color: var(--blue); }
.drop-zone strong { color: var(--ink); font-size: .93rem; }
.upload-mark { display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: 50%; background: #e2f3ff; color: var(--blue); font-size: 1.2rem; font-weight: 700; }
.reference-previews { display: grid; grid-template-columns: repeat(auto-fill, minmax(5rem, 1fr)); gap: .55rem; }
.reference-previews:not(:empty) { margin-top: .7rem; }
.reference-thumb { position: relative; aspect-ratio: 1; overflow: hidden; border: 1px solid var(--line); border-radius: .45rem; background: var(--paper); }
.reference-thumb img { width: 100%; height: 100%; object-fit: cover; }
.remove-photo { position: absolute; top: .15rem; right: .15rem; display: grid; place-items: center; width: 2.75rem; height: 2.75rem; border: 0; border-radius: 50%; background: var(--white); color: #a81937; font-size: 1.25rem; box-shadow: var(--shadow); }
.generate-row { display: grid; justify-items: start; gap: .5rem; margin-top: .85rem; }
.button:disabled { cursor: not-allowed; color: #53606a; background: #e7edf1; }
.generated-section { margin-top: 1.2rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.text-button { min-height: 2.75rem; border: 0; background: transparent; color: var(--blue); font-weight: 700; text-decoration: underline; text-underline-offset: .15rem; }
.generated-images { display: grid; gap: .75rem; margin-top: .75rem; }
.generated-card { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: .65rem; background: var(--white); }
.generated-card img { display: block; width: 100%; aspect-ratio: 1; object-fit: contain; background: var(--paper); }
.generated-card a { display: grid; place-items: center; min-height: 2.75rem; padding-inline: .5rem; color: var(--blue); font-size: .875rem; font-weight: 700; text-align: center; }
@media (min-width: 40rem) {
  .wrap { width: min(100% - 3rem, 72rem); }
  .header { padding-top: 1.25rem; }
  .header-inner { gap: 1rem; padding: .65rem .9rem; }
  .header-cta { display: inline-flex; }
  .hero { padding-top: 4rem; }
  .hero h1 { max-width: 22ch; }
  .section-heading { grid-template-columns: minmax(0, 1fr) minmax(12rem, 19rem); }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .generated-images { grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); }
  .editor-header, .editor-grid { padding-inline: 1.5rem; }
}
@media (min-width: 48rem) {
  .hero-break { display: initial; }
  .steps { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .editor-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.4rem; }
  #output { min-height: 23rem; }
}
@media (min-width: 64rem) {
  .header-inner { min-height: 4.4rem; }
  .brand img { width: 5rem; }
  nav { gap: 1.5rem; }
  .hero { padding-top: 4.65rem; }
  .cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* Studio profiles and recent work */
[hidden] { display: none !important; }
:root { --ease-out: cubic-bezier(.2, .7, .3, 1); }
.header-inner { column-gap: .65rem; }
nav { order: 1; flex: 1 1 100%; justify-content: space-between; flex-wrap: wrap; margin-left: 0; gap: 0 .8rem; }
nav a[aria-current="page"] { color: var(--blue); box-shadow: inset 0 -2px var(--blue); }
.profile-pill {
  max-width: min(38vw, 13rem);
  overflow: hidden;
  margin-left: auto;
  padding: .4rem .75rem;
  border-radius: 2rem;
  background: #e8f5ff;
  color: #005b97;
  font-size: .82rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.profile-pill::before { content: "✦"; margin-right: .38rem; color: var(--blue); }
.hero { background: radial-gradient(ellipse at 50% 8%, #eaf7ff, #fff 60%); }
.hero-art { border-radius: .9rem; }
.card, .card-button, .button, .filter, .icon-button, .history-thumbnail { transition: background-color .16s, border-color .16s, box-shadow .2s, transform .2s var(--ease-out); }
.card-link span { display: inline-block; transition: transform .2s var(--ease-out); }
.button:active, .filter:active { transform: scale(.97); }
@media (hover: hover) {
  .card:hover { transform: translateY(-.2rem); border-color: #acd4ec; box-shadow: var(--shadow); }
  .card-button:hover .card-link span { transform: translate(.15rem, -.15rem); }
  .history-thumbnail:hover { transform: translateY(-.15rem); box-shadow: var(--shadow); }
}
.studio-dialog {
  width: min(100% - 2rem, 28rem);
  max-height: calc(100dvh - 2rem);
  padding: clamp(1.25rem, 5vw, 2rem);
  border: 1px solid var(--line);
  border-radius: 1.25rem;
  background: var(--white);
  color: var(--ink);
  box-shadow: 0 1.1rem 4rem #01182b40;
}
.studio-dialog::backdrop { background: #01182ba8; backdrop-filter: blur(.2rem); }
.studio-dialog img { display: block; margin-bottom: .9rem; object-fit: contain; }
.studio-dialog h2 { margin-bottom: .55rem; font-size: clamp(1.5rem, 4vw, 2rem); }
.studio-dialog p { color: var(--muted); }
.studio-dialog form { display: grid; gap: .65rem; margin-top: 1rem; }
.studio-dialog form label, .history-filters label { font-size: .88rem; font-weight: 700; }
.studio-dialog input, .history-filters input, .history-filters select {
  width: 100%;
  min-width: 0;
  min-height: 2.85rem;
  padding: .55rem .7rem;
  border: 1px solid #afc1cc;
  border-radius: .58rem;
  background: var(--white);
  color: var(--ink);
  font: inherit;
}
.studio-dialog .form-note { font-size: .82rem; }
.studio-dialog .form-status { color: #9a2037; font-size: .85rem; }
.form-status:empty { display: none; }
.delete-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: .6rem; margin-top: 1rem; }
.danger { background: #a61d37; color: var(--white); }
.danger:hover { background: #87152a; }
.recent-work { min-height: 65vh; background: var(--paper); }
.recent-banner { margin-top: 1.1rem; padding-block: clamp(2rem, 6vw, 4rem); color: var(--white); background: linear-gradient(110deg, #0c2634, #0066aa 100%); }
.recent-intro { display: flex; align-items: end; justify-content: space-between; flex-wrap: wrap; gap: 1rem; }
.recent-intro h1 { font-size: clamp(2.1rem, 6vw, 4rem); letter-spacing: -.045em; }
.recent-intro h1:focus { outline: none; }
.recent-intro p { margin-top: .45rem; color: #e3f3ff; }
.recent-body { padding-block: 1.4rem 3.5rem; }
.history-scope { display: inline-flex; gap: .2rem; margin-bottom: .8rem; padding: .25rem; border: 1px solid var(--line); border-radius: 2rem; background: #eaf5fc; }
.history-scope button { min-height: 2.75rem; padding: .4rem 1rem; border: 0; border-radius: 2rem; background: transparent; color: var(--blue); font-weight: 700; }
.history-scope button[aria-pressed="true"] { background: var(--white); box-shadow: 0 .15rem .35rem #0c26341f; color: var(--ink); }
.history-filters { display: grid; gap: .75rem; }
.history-filters label { display: grid; gap: .25rem; min-width: 0; }
.history-status { min-height: 1.5em; margin: .75rem 0 .5rem; color: var(--muted); font-size: .88rem; }
.history-items { display: grid; gap: .9rem; }
.history-items[aria-busy="true"] { opacity: .65; }
.history-empty, .history-card { min-width: 0; padding: 1rem 1.15rem; border: 1px solid var(--line); border-radius: 1rem; background: var(--white); }
.history-empty { display: grid; justify-items: start; gap: .6rem; }
.history-empty h2, .history-card h2 { font-size: 1.2rem; letter-spacing: -.02em; overflow-wrap: anywhere; }
.history-empty p, .work-meta { color: var(--muted); }
.work-heading { display: flex; justify-content: space-between; align-items: start; gap: .5rem; }
.work-meta { margin-top: .3rem; font-size: .83rem; overflow-wrap: anywhere; }
.delete-text { flex-shrink: 0; padding: .3rem .25rem; color: #a61d37; font-size: .8rem; }
.delete-text:hover { color: #721429; }
.history-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 7.5rem), 1fr)); gap: .65rem; margin-top: .75rem; }
.history-image { display: flex; flex-direction: column; align-items: center; gap: .1rem; min-width: 0; margin: 0; }
.history-thumbnail { display: grid; place-items: center; width: 100%; overflow: hidden; aspect-ratio: 1; border: 1px solid var(--line); border-radius: .65rem; background: #edf3f7; color: var(--muted); text-align: center; }
.history-thumbnail img { width: 100%; height: 100%; object-fit: contain; }
.work-prompt { margin-top: .7rem; border-top: 1px solid var(--line); }
.work-prompt summary { display: list-item; min-height: 2.75rem; padding-top: .65rem; color: var(--blue); font-size: .9rem; font-weight: 700; cursor: pointer; }
.work-prompt pre { max-height: 18rem; overflow: auto; margin: 0; padding: .7rem; border-radius: .45rem; background: var(--paper); color: var(--ink); font: .87rem/1.55 var(--body); white-space: pre-wrap; overflow-wrap: anywhere; }
.history-pagination { display: flex; flex-wrap: wrap; gap: .65rem; margin-top: 1rem; }
@media (min-width: 40rem) {
  nav { order: 0; flex: 0 1 auto; justify-content: initial; margin-left: auto; }
  .profile-pill { margin-left: 0; }
  .history-filters { grid-template-columns: repeat(2, minmax(0, 16rem)); }
}
@media (min-width: 48rem) {
  .history-items { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  .history-empty { grid-column: 1 / -1; }
}
@media (prefers-reduced-motion: no-preference) {
  .studio-dialog[open], .editor[open], .recent-work:not([hidden]) { animation: studio-enter .22s var(--ease-out) both; }
  .reference-thumb, .generated-card, .history-card { animation: studio-enter .22s var(--ease-out) both; }
  @keyframes studio-enter {
    from { opacity: .35; transform: translateY(.35rem); }
    to { opacity: 1; transform: translateY(0); }
  }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0s !important; transition-duration: 0s !important; }
  .card:hover, .button:active, .filter:active, .history-thumbnail:hover { transform: none; }
}
