/*
 * Easy Exif — the website pages. Layout, top bar, buttons and sections follow
 * can-i-format's site.css so the projects read as one family. The palette is
 * warm paper neutrals, with green for anything you act on.
 */

:root {
  --bg: #f5f1e8;
  --surface: #fffcf5;
  --surface-2: #efe9dc;
  --border: #e2d9c6;
  --border-strong: #cbbfa6;
  --text: #1f1c16;
  --text-dim: #615847;
  --text-faint: #91866f;

  --accent: #1f8a4c;
  --accent-text: #ffffff;
  /* Green for links and small tags. Same as --accent on the light page. */
  --accent-light: #1f8a4c;

  --safe: #17803d;
  --safe-bg: #e8f6ed;
  --safe-border: #a8dcbc;

  --radius: 10px;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171512;
    --surface: #1f1c18;
    --surface-2: #28241f;
    --border: #35302a;
    --border-strong: #4a433a;
    --text: #f0ebe2;
    --text-dim: #b5ab9b;
    --text-faint: #837a6b;

    --accent: #4caf6e;
    --accent-text: #0b1a10;
    --accent-light: #8fd3a5;

    --safe: #58d68d;
    --safe-bg: #14291d;
    --safe-border: #2b6b45;
  }
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body {
  margin: 0;
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
}

h1,
h2,
h3 {
  margin: 0;
  font-weight: 600;
  letter-spacing: -0.01em;
}
h1 {
  font-size: 1.05rem;
}
h2 {
  font-size: 1rem;
}

a {
  color: var(--accent-light);
}

code {
  font-family: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Menlo, Consolas, monospace;
  font-size: 0.88em;
  background: var(--surface-2);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

/* ---- chrome ------------------------------------------------------------ */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1.25rem;
  background: var(--bg);
  border-bottom: 1px solid transparent;
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}
.brand-mark {
  display: block;
  flex: none;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.topbar-link {
  font-size: 0.875rem;
  color: var(--text-dim);
  text-decoration: none;
  padding: 0.4rem 0.7rem;
  border-radius: 8px;
}
.topbar-link:hover {
  background: var(--surface-2);
  color: var(--text);
}

.button {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.95rem;
  font-weight: 550;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  padding: 0.6rem 1.1rem;
  text-decoration: none;
  transition: background 0.12s ease, border-color 0.12s ease, filter 0.12s ease;
}
.button:hover {
  background: var(--surface-2);
}
.button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
}
.button.primary:hover {
  filter: brightness(1.08);
}
.topbar .button {
  font-size: 0.875rem;
  padding: 0.4rem 0.85rem;
}

main {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

.eyebrow {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 0.6rem;
}

/* ---- hero --------------------------------------------------------------- */

.landing-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 3rem;
  align-items: center;
  padding: 4.5rem 0 3.5rem;
}
.landing-hero h2 {
  font-size: clamp(2rem, 4.4vw, 3rem);
  line-height: 1.1;
  letter-spacing: -0.025em;
  margin-bottom: 1rem;
  text-wrap: balance;
}
.landing-hero .lede {
  font-size: 1.1rem;
  color: var(--text-dim);
  max-width: 48ch;
  margin: 0 0 1.75rem;
}
.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
}
.reassure {
  margin: 1.25rem 0 0;
  font-size: 0.85rem;
  color: var(--text-faint);
}

/* ---- demo ---------------------------------------------------------------
 * The editor in miniature, cycling through the four steps. demo.js moves
 * data-step along; everything else is CSS transitions keyed off it. The
 * overlays copy the editor's canvas drawing, in units of --u (the editor's
 * `unit`: a hundredth of the short side, here at 1.8× size so it reads).
 */

.demo {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.1rem;
  box-shadow: 0 18px 40px -24px rgb(0 0 0 / 0.35);
}
.demo-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.8rem;
  font-size: 0.85rem;
  color: var(--text-dim);
}
.demo-head strong {
  color: var(--text);
  font-size: 0.95rem;
}
.demo-head span {
  font-variant-numeric: tabular-nums;
}

.frame {
  position: relative;
  aspect-ratio: 3 / 2;
  border-radius: 8px;
  overflow: hidden;
  container-type: inline-size;
  background: var(--surface-2);
  --u: calc(100cqw / 150 * 1.8);
}

.drop {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 0.25rem;
  border: 2px dashed var(--border-strong);
  border-radius: 8px;
  color: var(--text-faint);
  font-size: 0.85rem;
  text-align: center;
  transition: opacity 0.4s ease, border-color 0.3s ease;
}
.drop b {
  color: var(--text);
  font-weight: 600;
}

.file {
  position: absolute;
  top: 38%;
  left: 50%;
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 8px 20px -8px rgb(0 0 0 / 0.4);
  font-size: 0.8rem;
  white-space: nowrap;
  opacity: 0;
  transform: translate(60%, -180%) rotate(6deg);
}

.photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  opacity: 0;
  transform: scale(1.03);
  transition: opacity 0.6s ease, transform 0.9s ease;
}

.ov {
  position: absolute;
  color: #fff;
  opacity: 0;
  transition: opacity 0.45s ease;
  pointer-events: none;
}
.ov .t {
  font-weight: 600;
}
.ov .dim {
  opacity: 0.85;
}

.ov-corner {
  left: calc(var(--u) * 3);
  bottom: calc(var(--u) * 3);
  padding: calc(var(--u) * 0.8) calc(var(--u) * 2);
  border-radius: calc(var(--u) * 0.9);
  background: rgb(0 0 0 / 0.55);
  line-height: calc(var(--u) * 2.6);
}
.ov-corner .t {
  font-size: calc(var(--u) * 2.2);
}
.ov-corner .x {
  font-size: calc(var(--u) * 1.8);
  font-weight: 600;
}
.ov-corner .g {
  font-size: calc(var(--u) * 1.5);
}

.ov-bar {
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: calc(var(--u) * 2);
  min-height: calc(var(--u) * 9);
  padding: calc(var(--u) * 1.6) calc(var(--u) * 4);
  background: rgb(0 0 0 / 0.55);
  line-height: calc(var(--u) * 2.6);
}
.ov-bar .t {
  font-size: calc(var(--u) * 2.6);
}
.ov-bar .r {
  text-align: right;
}
.ov-bar .x {
  font-size: calc(var(--u) * 1.9);
  font-weight: 600;
}
.ov-bar .g {
  font-size: calc(var(--u) * 1.5);
}

.ov-side {
  top: 0;
  right: 0;
  bottom: 0;
  width: calc(var(--u) * 30);
  padding: calc(var(--u) * 4) calc(var(--u) * 2.5);
  background: rgb(0 0 0 / 0.55);
}
.ov-side .t {
  font-size: calc(var(--u) * 2.4);
  line-height: 1.2;
  margin-bottom: calc(var(--u) * 1.8);
}
.ov-side dl {
  margin: 0;
}
.ov-side dt {
  font-size: calc(var(--u) * 1.2);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.6;
}
.ov-side dd {
  margin: 0 0 calc(var(--u) * 1.2);
  font-size: calc(var(--u) * 1.6);
  font-weight: 600;
}

.ov-credit {
  right: calc(var(--u) * 3);
  bottom: calc(var(--u) * 3);
  font-size: calc(var(--u) * 1.5);
  opacity: 0;
  text-shadow: 0 1px 6px rgb(0 0 0 / 0.55);
}

/* Under the frame: the read settings, then the style picker and download. */
.demo-panel {
  display: grid;
  gap: 0.6rem;
  margin-top: 0.8rem;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  min-height: 1.7rem;
  font-size: 0.78rem;
}
.chips span {
  padding: 0.15rem 0.5rem;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.chips .flag {
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  color: var(--accent-light);
  font-weight: 600;
}

.controls {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.style-pick {
  padding: 0.3rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface-2);
  color: var(--text-dim);
  font-size: 0.78rem;
  transition: background 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}
.save {
  margin-left: auto;
  padding: 0.3rem 0.75rem;
  border-radius: 7px;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 0.78rem;
  font-weight: 600;
  transition: transform 0.15s ease, filter 0.15s ease;
}
.saved {
  position: absolute;
  left: 50%;
  top: calc(var(--u) * 3);
  padding: 0.3rem 0.75rem;
  border: 1px solid var(--safe-border);
  border-radius: 999px;
  background: var(--safe-bg);
  color: var(--safe);
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  opacity: 0;
  transform: translate(-50%, -6px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.demo-steps {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.35rem;
  margin: 0.9rem 0 0;
  padding: 0.8rem 0 0;
  border-top: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--text-faint);
  counter-reset: step;
}
.demo-steps li {
  counter-increment: step;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: color 0.25s ease;
}
.demo-steps li::before {
  content: counter(step);
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 1.3rem;
  height: 1.3rem;
  border-radius: 50%;
  background: var(--surface-2);
  font-weight: 650;
  transition: background 0.25s ease, color 0.25s ease;
}

/* -- the states, in order -- */

[data-step="drop"] .file {
  animation: drop-in 1.2s ease-out 0.2s both;
}
[data-step="drop"] .drop {
  border-color: var(--accent);
}
@keyframes drop-in {
  0% {
    opacity: 0;
    transform: translate(60%, -180%) rotate(6deg);
  }
  25% {
    opacity: 1;
  }
  75% {
    opacity: 1;
    transform: translate(-50%, 0) rotate(0);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, 0) scale(0.9);
  }
}

.demo:not([data-step="drop"]) .drop {
  opacity: 0;
}
.demo:not([data-step="drop"]) .photo {
  opacity: 1;
  transform: none;
}

.demo:not([data-step="drop"]) .chips span {
  opacity: 1;
  transform: none;
}
[data-step="corner"] .chips span:nth-child(2) { transition-delay: 0.25s; }
[data-step="corner"] .chips span:nth-child(3) { transition-delay: 0.4s; }
[data-step="corner"] .chips span:nth-child(4) { transition-delay: 0.55s; }
[data-step="corner"] .chips span:nth-child(5) { transition-delay: 0.7s; }
[data-step="corner"] .chips span:nth-child(6) { transition-delay: 0.85s; }
[data-step="corner"] .chips span:nth-child(7) { transition-delay: 1s; }

[data-step="corner"] .ov-corner,
[data-step="bar"] .ov-bar,
[data-step="sidebar"] .ov-side,
[data-step="save"] .ov-corner,
[data-step="corner"] .ov-credit,
[data-step="save"] .ov-credit {
  opacity: 1;
}
[data-step="corner"] .ov-credit,
[data-step="save"] .ov-credit {
  opacity: 0.85;
}

[data-step="corner"] [data-style="corner"],
[data-step="bar"] [data-style="bar"],
[data-step="sidebar"] [data-style="sidebar"],
[data-step="save"] [data-style="corner"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
}

[data-step="save"] .save {
  animation: press 0.5s ease 0.3s;
}
@keyframes press {
  50% {
    transform: scale(0.92);
    filter: brightness(1.15);
  }
}
[data-step="save"] .saved {
  opacity: 1;
  transform: translate(-50%, 0);
  transition-delay: 0.6s;
}

[data-step="drop"] .demo-steps li:nth-child(1),
[data-step="corner"] .demo-steps li:nth-child(2),
[data-step="bar"] .demo-steps li:nth-child(2),
[data-step="sidebar"] .demo-steps li:nth-child(2),
[data-step="save"] .demo-steps li:nth-child(3) {
  color: var(--text);
}
[data-step="drop"] .demo-steps li:nth-child(1)::before,
[data-step="corner"] .demo-steps li:nth-child(2)::before,
[data-step="bar"] .demo-steps li:nth-child(2)::before,
[data-step="sidebar"] .demo-steps li:nth-child(2)::before,
[data-step="save"] .demo-steps li:nth-child(3)::before {
  background: var(--accent);
  color: var(--accent-text);
}

/* ---- sections ----------------------------------------------------------- */

.band {
  padding: 3.5rem 0;
  border-top: 1px solid var(--border);
  scroll-margin-top: 3.5rem;
}
.band > h2 {
  font-size: clamp(1.4rem, 2.6vw, 1.85rem);
  letter-spacing: -0.02em;
  margin-bottom: 0.6rem;
  text-wrap: balance;
}
.band > .intro {
  color: var(--text-dim);
  max-width: 62ch;
  margin: 0 0 2rem;
}

.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  counter-reset: step;
}
.steps li {
  counter-increment: step;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}
.steps li::before {
  content: counter(step);
  display: inline-grid;
  place-items: center;
  width: 1.8rem;
  height: 1.8rem;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 650;
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
}

.steps h3 {
  font-size: 1rem;
  margin-bottom: 0.35rem;
}
.steps p {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.92rem;
}

.ui {
  font-size: 0.86em;
  font-weight: 600;
  padding: 0.05em 0.4em;
  border-radius: 5px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  white-space: nowrap;
}

.site-foot {
  border-top: 1px solid var(--border);
  padding: 1.5rem 1.25rem 2rem;
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-faint);
}
.site-foot p {
  margin: 0.25rem 0;
}
.site-foot a {
  color: var(--text-dim);
}

/* ---- guide -------------------------------------------------------------- */

.guide {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 3rem;
  padding: 2.5rem 0 4rem;
}

.toc {
  position: sticky;
  top: 4.5rem;
  align-self: start;
  max-height: calc(100vh - 5.5rem);
  overflow-y: auto;
  font-size: 0.88rem;
}
.toc p {
  margin: 0 0 0.5rem;
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.toc ol {
  list-style: none;
  margin: 0;
  padding: 0;
}
.toc a {
  display: block;
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  color: var(--text-dim);
  text-decoration: none;
}
.toc a:hover {
  color: var(--text);
  background: var(--surface-2);
}

.prose {
  max-width: 72ch;
}
.prose > header {
  margin-bottom: 2.5rem;
}
.prose > header h2 {
  font-size: clamp(1.8rem, 3.6vw, 2.4rem);
  letter-spacing: -0.025em;
  margin-bottom: 0.6rem;
}
.prose > header p:not(.eyebrow) {
  font-size: 1.05rem;
  color: var(--text-dim);
  margin: 0;
}
.prose section {
  padding-top: 1rem;
  margin-bottom: 2.25rem;
  scroll-margin-top: 4rem;
}
.prose section + section {
  border-top: 1px solid var(--border);
  padding-top: 2.25rem;
}
.prose h3 {
  font-size: 1.35rem;
  letter-spacing: -0.015em;
  margin-bottom: 0.75rem;
}
.prose h4 {
  font-size: 1rem;
  margin: 1.5rem 0 0.4rem;
}
.prose p {
  margin: 0 0 0.9rem;
}
.prose ul,
.prose ol {
  margin: 0 0 1rem;
  padding-left: 1.3rem;
}
.prose li {
  margin-bottom: 0.4rem;
}

.table-wrap {
  overflow-x: auto;
  margin: 0 0 1rem;
}
.prose table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.9rem;
}
.prose th,
.prose td {
  text-align: left;
  vertical-align: top;
  padding: 0.5rem 0.7rem;
  border-bottom: 1px solid var(--border);
}
.prose th {
  font-weight: 600;
  color: var(--text-dim);
  font-size: 0.82rem;
}

.callout {
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  margin: 0 0 1rem;
  border: 1px solid var(--border);
  background: var(--surface);
}
.callout p:last-child {
  margin-bottom: 0;
}

kbd {
  font-family: var(--sans);
  font-size: 0.86em;
  font-weight: 600;
  padding: 0.05em 0.4em;
  border-radius: 5px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  white-space: nowrap;
}

@media (max-width: 860px) {
  .guide {
    grid-template-columns: minmax(0, 1fr);
    gap: 1.5rem;
    padding-top: 1.5rem;
  }
  .toc {
    position: static;
    max-height: none;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    padding: 0.85rem;
  }
  .toc > ol {
    columns: 2;
    column-gap: 0.5rem;
  }
}

@media (max-width: 560px) {
  .toc > ol {
    columns: 1;
  }
}

/* ---- about -------------------------------------------------------------- */

/* Who made it, laid out as on can-i-format's about page: the photo with the
   name beside it, sitting on its bottom edge; then the links with the words
   beside them, starting level. */
.about {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  grid-template-areas:
    "photo intro"
    "links text";
  column-gap: 3rem;
  row-gap: 1.5rem;
  align-items: start;
  max-width: 820px;
  margin: 0 auto;
  padding: 3rem 0;
}
/* Cropped to a circle by the browser, so the file stays a plain square. */
.avatar {
  grid-area: photo;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border);
}
.socials {
  grid-area: links;
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.1rem;
}
.socials a {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.3rem 0;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.92rem;
}
.socials a:hover {
  color: var(--accent-light);
}
.socials svg {
  flex: none;
}
.about-intro {
  grid-area: intro;
  align-self: end;
}
.about-intro .eyebrow {
  margin-bottom: 0.3rem;
}
.about-intro h2 {
  font-size: 2.2rem;
  letter-spacing: -0.025em;
}
.about-text {
  grid-area: text;
  max-width: 72ch;
  /* Matches the links' top padding, so the first line sits level with the
     first link. */
  padding-top: 0.3rem;
}
.about-text p {
  margin: 0 0 0.9rem;
}
.about-cta {
  margin-top: 1.8rem;
}

@media (max-width: 760px) {
  .about {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "photo"
      "intro"
      "text"
      "links";
    padding: 2.5rem 0;
  }
  .avatar {
    width: 112px;
    height: 112px;
  }
  .about-intro h2 {
    font-size: 1.8rem;
  }
}

/* ---- narrow screens ----------------------------------------------------- */

@media (max-width: 1060px) {
  .steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .landing-hero {
    grid-template-columns: minmax(0, 1fr);
    gap: 2rem;
    padding: 2.75rem 0 2.5rem;
  }
  .steps {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 560px) {
  main {
    padding: 0 16px;
  }
  .topbar {
    padding: 0.65rem 16px;
  }
  .topbar-right {
    gap: 0.25rem;
  }
  .brand h1 {
    white-space: nowrap;
  }
  /* The name and Open the editor fit at phone width; the section link goes. */
  .topbar .topbar-link {
    display: none;
  }
}

@media (max-width: 380px) {
  .topbar .brand-mark {
    display: none;
  }
  .topbar .button {
    padding: 0.4rem 0.65rem;
  }
}
