:root {
  color-scheme: light;
  --bg: #f7f4ec;
  --surface: #fffdf8;
  --surface-strong: #ffffff;
  --ink: #1f2430;
  --muted: #6d7280;
  --line: #ded8ca;
  --brand: #176b87;
  --brand-strong: #0f4f64;
  --accent: #d96c47;
  --green: #4b7f52;
  --shadow: 0 18px 60px rgba(44, 38, 28, 0.12);
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111318;
  --surface: #181b22;
  --surface-strong: #20242d;
  --ink: #f3efe7;
  --muted: #a8adba;
  --line: #303541;
  --brand: #6fc3df;
  --brand-strong: #91d7ec;
  --accent: #ef9069;
  --green: #8fcf96;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(23, 107, 135, 0.12), transparent 30rem),
    linear-gradient(135deg, var(--bg), var(--surface));
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

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

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 17.5rem minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  padding: 1.25rem;
  border-right: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(18px);
}

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

.brand-mark {
  display: grid;
  width: 2.75rem;
  height: 2.75rem;
  place-items: center;
  border-radius: 0.75rem;
  background: var(--ink);
  color: var(--surface);
  font-weight: 800;
}

.brand strong,
.brand small {
  display: block;
}

.brand small,
.eyebrow {
  color: var(--muted);
  font-size: 0.75rem;
}

.nav {
  display: grid;
  gap: 0.4rem;
}

.nav a {
  display: flex;
  gap: 0.7rem;
  align-items: center;
  min-height: 2.75rem;
  padding: 0.7rem 0.85rem;
  border-radius: 0.5rem;
  color: var(--muted);
  text-decoration: none;
}

.nav a.active,
.nav a:hover {
  background: color-mix(in srgb, var(--brand) 12%, transparent);
  color: var(--brand-strong);
}

.sidebar-panel {
  margin-top: auto;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  color: var(--muted);
  line-height: 1.65;
}

main {
  padding: 1.5rem clamp(1rem, 3vw, 3rem) 3rem;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.lang-switch {
  display: flex;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  overflow: hidden;
  background: var(--surface);
}

.lang-button {
  min-width: 2.75rem;
  height: 2.75rem;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}

.lang-button.active {
  background: color-mix(in srgb, var(--brand) 15%, transparent);
  color: var(--brand-strong);
}

.topbar h1,
.section-heading h2,
.generated-content h2 {
  margin: 0;
  letter-spacing: 0;
}

.topbar h1 {
  max-width: 46rem;
  font-size: clamp(2rem, 4vw, 4.8rem);
  line-height: 1.02;
}

.eyebrow {
  margin: 0 0 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.icon-button {
  display: grid;
  width: 2.75rem;
  height: 2.75rem;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: var(--surface);
  color: var(--ink);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(20rem, 0.95fr) minmax(22rem, 1.05fr);
  gap: 1rem;
  align-items: start;
}

.capture-panel,
.memory-card,
.timeline-panel,
.map-panel,
.insight-panel {
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: color-mix(in srgb, var(--surface-strong) 94%, transparent);
  box-shadow: var(--shadow);
}

.capture-panel {
  padding: 1.25rem;
}

.section-heading {
  margin-bottom: 1rem;
}

.section-heading h2 {
  font-size: 1.25rem;
}

.memory-form {
  display: grid;
  gap: 1rem;
}

label {
  display: grid;
  gap: 0.45rem;
  color: var(--muted);
  font-size: 0.9rem;
}

textarea,
input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: var(--surface);
  color: var(--ink);
  outline: none;
}

textarea {
  resize: vertical;
  min-height: 9rem;
  padding: 0.9rem;
  line-height: 1.65;
}

input,
select {
  min-height: 2.75rem;
  padding: 0 0.8rem;
}

textarea:focus,
input:focus,
select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent);
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 10rem;
  gap: 0.8rem;
}

.upload-zone {
  place-items: center;
  min-height: 8rem;
  padding: 1rem;
  border: 1px dashed color-mix(in srgb, var(--brand) 52%, var(--line));
  border-radius: 0.5rem;
  background: color-mix(in srgb, var(--brand) 8%, var(--surface));
  text-align: center;
}

.upload-zone input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
}

.upload-icon {
  display: grid;
  width: 2.6rem;
  height: 2.6rem;
  place-items: center;
  border-radius: 0.5rem;
  background: var(--surface-strong);
  color: var(--brand-strong);
  font-size: 1.35rem;
}

.preview-strip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(4.2rem, 1fr));
  gap: 0.5rem;
}

.preview-strip img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 0.5rem;
}

.primary-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 3.2rem;
  padding: 0 1rem;
  border: 0;
  border-radius: 0.5rem;
  background: var(--ink);
  color: var(--surface);
  font-weight: 800;
}

.primary-action[disabled] {
  cursor: wait;
  opacity: 0.72;
}

.secondary-action {
  min-height: 2.75rem;
  margin-top: 1rem;
  padding: 0 0.9rem;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: var(--surface);
  color: var(--brand-strong);
  font-weight: 800;
}

.memory-card {
  overflow: hidden;
}

.photo-collage {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  grid-template-rows: 11rem 11rem;
  gap: 0.5rem;
  padding: 0.5rem;
}

.photo-collage img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 0.45rem;
}

.photo-collage img:first-child {
  grid-row: span 2;
}

.generated-content {
  padding: 1.25rem;
}

.generated-content h2 {
  margin-bottom: 0.8rem;
  font-size: clamp(1.45rem, 2vw, 2.1rem);
}

.generated-content p {
  color: var(--muted);
  line-height: 1.8;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 1rem;
}

.tag-row .secondary-action {
  min-height: 2.4rem;
  margin-top: 0;
}

.tag-row span,
.place-list span {
  padding: 0.45rem 0.65rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
  color: color-mix(in srgb, var(--accent) 80%, var(--ink));
  font-size: 0.82rem;
}

.vault-panel {
  margin-top: 1rem;
  padding: 1.25rem;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: color-mix(in srgb, var(--surface-strong) 94%, transparent);
  box-shadow: var(--shadow);
}

.ask-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 2.75rem;
  gap: 0.75rem;
  align-items: end;
}

.answer-box {
  margin: 1rem 0;
  padding: 0.9rem;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: color-mix(in srgb, var(--brand) 8%, var(--surface));
  color: var(--muted);
  line-height: 1.65;
}

.vault-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}

.vault-item {
  min-height: 10rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: var(--surface);
}

.vault-item time {
  color: var(--muted);
  font-size: 0.78rem;
}

.vault-item strong {
  display: block;
  margin: 0.35rem 0;
}

.vault-item p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.comment-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 2.75rem;
  gap: 0.45rem;
  margin-top: 0.7rem;
}

.comment-form input {
  min-height: 2.75rem;
}

.comments {
  margin-top: 0.65rem;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.55;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 1rem;
  margin-top: 1rem;
}

.timeline-panel,
.map-panel,
.insight-panel {
  padding: 1.25rem;
}

.timeline-panel {
  grid-row: span 2;
}

.timeline {
  display: grid;
  gap: 1rem;
  padding: 0;
  margin: 0;
  list-style: none;
}

.timeline li {
  padding-left: 1rem;
  border-left: 3px solid var(--brand);
}

.timeline time {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
}

.timeline strong {
  display: block;
  margin: 0.25rem 0;
}

.timeline p,
.insight-list p,
.vault-item p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.map-visual {
  position: relative;
  min-height: 15rem;
  overflow: hidden;
  border-radius: 0.5rem;
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--line) 52%, transparent) 1px, transparent 1px),
    linear-gradient(color-mix(in srgb, var(--line) 52%, transparent) 1px, transparent 1px),
    color-mix(in srgb, var(--green) 10%, var(--surface));
  background-size: 2.25rem 2.25rem;
}

.route-line {
  position: absolute;
  inset: 25% 19% 31% 23%;
  border-top: 3px solid var(--accent);
  border-right: 3px solid var(--accent);
  border-radius: 0 4rem 0 0;
  transform: rotate(-8deg);
}

.pin {
  position: absolute;
  z-index: 1;
  width: 1rem;
  height: 1rem;
  border: 3px solid var(--surface-strong);
  border-radius: 999px;
  background: var(--brand);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--brand) 24%, transparent);
}

.pin-a {
  left: 20%;
  top: 60%;
}

.pin-b {
  left: 50%;
  top: 36%;
  background: var(--accent);
}

.pin-c {
  right: 20%;
  top: 56%;
  background: var(--green);
}

.place-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.9rem;
}

.insight-list {
  display: grid;
  gap: 0.8rem;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .nav {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .nav a {
    justify-content: center;
  }

  .sidebar-panel {
    display: none;
  }

  .workspace,
  .dashboard-grid,
  .vault-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  main {
    padding-inline: 0.85rem;
  }

  .topbar {
    align-items: flex-start;
  }

  .topbar-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .topbar h1 {
    font-size: 2.25rem;
  }

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

  .photo-collage {
    grid-template-rows: 9rem 9rem;
  }
}
