@font-face {
  font-family: "Brown";
  font-style: normal;
  font-weight: 100 400;
  font-display: swap;
  src: url("/static/fonts/brown-light.woff2") format("woff2");
}

@font-face {
  font-family: "Brown";
  font-style: normal;
  font-weight: 401 600;
  font-display: swap;
  src: url("/static/fonts/brown-medium.woff2") format("woff2");
}

@font-face {
  font-family: "Brown";
  font-style: normal;
  font-weight: 601 900;
  font-display: swap;
  src: url("/static/fonts/brown-bold.woff2") format("woff2");
}

@font-face {
  font-family: "Domaine Sans Text";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/static/fonts/domaine-sans-text-medium.woff2") format("woff2");
}

:root {
  --color-primary: #fbf9f3;
  --color-tertiary: #000;
  --color-tertiary-lightest: #e5e5e5;
  --color-error: #b3261e;
  --font-heading: "Domaine Sans Text", "Inter", sans-serif;
  --font-body: "Brown", -apple-system, "Segoe UI", Roboto, sans-serif;
}

* {
  box-sizing: border-box;
}

[x-cloak] {
  display: none !important;
}

html,
body {
  margin: 0;
  height: 100%;
  background: var(--color-primary);
  color: var(--color-tertiary);
  font-family: var(--font-body);
}

.shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.page-header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  min-height: 44px;
  padding: 12px 20px;
  background: var(--color-primary);
  border-bottom: 1px solid var(--color-tertiary-lightest);
}

.shell-logo {
  position: absolute;
  left: 20px;
  height: 28px;
}

.segmented-control {
  display: inline-flex;
  border: 2px solid var(--color-tertiary);
}

.segmented-control button {
  min-height: 44px;
  min-width: 140px;
  padding: 0 20px;
  border: none;
  background: var(--color-primary);
  color: var(--color-tertiary);
  font-family: var(--font-heading);
  font-weight: 500;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
}

.segmented-control button.active {
  background: var(--color-tertiary);
  color: var(--color-primary);
}

/* Écrans étroits (iPhone, iframe réduite) : le logo sort du positionnement
   absolu pour ne plus passer sous les boutons, qui rétrécissent. */
@media (max-width: 760px) {
  .page-header {
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
  }

  .shell-logo {
    position: static;
    flex-shrink: 0;
    height: 20px;
  }

  .segmented-control {
    flex-shrink: 1;
    min-width: 0;
  }

  .segmented-control button {
    min-width: 0;
    min-height: 40px;
    padding: 0 12px;
    font-size: 12px;
    letter-spacing: 0.03em;
    white-space: nowrap;
  }
}

@media (max-width: 420px) {
  .page-header {
    gap: 8px;
    padding: 8px;
  }

  .shell-logo {
    height: 16px;
  }

  .segmented-control button {
    padding: 0 8px;
    font-size: 11px;
    letter-spacing: 0.02em;
  }
}

@media (max-width: 360px) {
  .page-header {
    gap: 6px;
    padding: 8px 6px;
  }

  .shell-logo {
    height: 12px;
  }

  .segmented-control button {
    padding: 0 6px;
    font-size: 10px;
    letter-spacing: 0;
  }
}

.shell-body {
  position: relative;
  flex: 1;
}

.shell-iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
}

.shell-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 100vh;
  padding: 20px;
  text-align: center;
  font-family: var(--font-heading);
  font-size: 18px;
}

.notes-pad {
  position: absolute;
  inset: 0;
  overflow: auto;
  padding: 24px 20px;
}

.notes-column {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 900px;
  height: 100%;
  margin: 0 auto;
}

.notes-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 16px;
}

.notes-title {
  margin: 0;
  font-family: var(--font-heading);
  font-weight: 500;
  font-size: 18px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.notes-status {
  font-size: 14px;
  opacity: 0.7;
}

.notes-status-error {
  opacity: 1;
  font-weight: 500;
  color: var(--color-error);
}

.notes-textarea {
  flex: 1;
  width: 100%;
  min-height: 200px;
  padding: 16px;
  border: 2px solid var(--color-tertiary);
  border-radius: 0;
  background: var(--color-primary);
  color: var(--color-tertiary);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  resize: none;
}

.notes-textarea:focus-visible {
  outline: 2px solid var(--color-tertiary);
  outline-offset: 2px;
}

.notes-textarea:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.notes-retry {
  align-self: flex-start;
  min-height: 44px;
  padding: 0 20px;
  border: 2px solid var(--color-tertiary);
  background: var(--color-tertiary);
  color: var(--color-primary);
  font-family: var(--font-heading);
  font-weight: 500;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
}
