:root {
  --bg: #f7f5f0;
  --card: #ffffff;
  --black: #1a1a1a;
  --muted: #6b6b6b;
  --border: #e2ddd2;
  --accent: #2b6cb0;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(0,0,0,0.04), 0 4px 16px rgba(0,0,0,0.06);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--black);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

.wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2em;
}

.layout {
  display: grid;
  grid-template-columns: minmax(320px, 380px) 1fr;
  gap: 1.5em;
  align-items: start;
}

header {
  margin-bottom: 2em;
}

h1 {
  margin: 0 0 0.25em;
  font-size: 1.85em;
}

.tagline {
  color: var(--muted);
  margin: 0;
  max-width: 80ch;
}

/** Why Section **/
.why-link {
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
  margin-left: 0.25em;

  &:hover { text-decoration: underline; }
}

.why-dialog {
  max-width: 560px;
  width: calc(100% - 2em);
  padding: 1.75em 1.75em 1.5em;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--black);
  box-shadow: 0 10px 40px rgba(0,0,0,0.2);
  position: relative;

  &::backdrop { background: rgba(0,0,0,0.45); }

  h2 {
    margin: 0 0 0.75em;
    font-size: 1.3em;
  }

  p {
    margin: 0 0 0.75em;
    line-height: 1.55;
  }

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

.why-close {
  position: absolute;
  top: 0.5em;
  right: 0.5em;
  background: transparent;
  color: var(--muted);
  border: none;
  font-size: 1.6em;
  line-height: 1;
  padding: 0.25em 0.5em;
  cursor: pointer;
  border-radius: 6px;

  &:hover { background: var(--bg); color: var(--black); }
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5em;
  box-shadow: var(--shadow);
}

form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1em;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35em;

  &.full { grid-column: 1 / -1; }
}

label {
  font-size: 0.85em;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  cursor: help;
  width: fit-content;
}

input {
  width: 100%;
  padding: 0.55em 0.7em;
  font: inherit;
  color: var(--black);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  transition: border-color 0.15s, box-shadow 0.15s;

  &:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(43,108,176,0.15);
  }
}

.actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  margin-top: 0.25em;
}

button {
  font: inherit;
  font-weight: 600;
  padding: 0.6em 1.25em;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s, transform 0.05s;

  &:hover { background: #2356a0; }
  &:active { transform: translateY(1px); }
}

.result {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1em;

  img {
    max-width: 100%;
    height: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
    box-shadow: var(--shadow);
  }
}

.image-wrap {
  position: relative;
  display: inline-block;
  max-width: 100%;

  img { display: block; }
}

.download {
  position: absolute;
  top: 0.75em;
  right: 0.75em;
  padding: 0.5em;
  color: var(--black);
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--border);
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 4px 12px rgba(0, 0, 0, 0.06);
  transition: background 0.15s, border-color 0.15s, transform 0.05s;

  &:hover { background: #fff; border-color: #cfc8b8; }
  &:active { transform: translateY(1px); }
  svg { display: block; }
}

@media (max-width: 820px) {
  .layout { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  form { grid-template-columns: 1fr; }
  .wrap { padding: 2em 1em 3em; }
  h1 { font-size: 1.5em; }
}
