/**
 * Forms.
 *
 * One stylesheet covers every form on the site — Contact Form 7, WooCommerce
 * checkout and account, comments, search — because they all render plain inputs.
 * Styling them centrally is why no form plugin needed replacing.
 */

/* ---- the shared control ---- */
.wpcf7 input[type="text"], .wpcf7 input[type="email"], .wpcf7 input[type="tel"],
.wpcf7 input[type="url"], .wpcf7 input[type="number"], .wpcf7 input[type="date"],
.wpcf7 select, .wpcf7 textarea,
.woocommerce form .form-row input.input-text, .woocommerce form .form-row textarea,
.woocommerce form .form-row select, .woocommerce-page form .form-row input.input-text,
#commentform input[type="text"], #commentform input[type="email"], #commentform textarea,
.eg-field input, .eg-field textarea, .eg-field select{
  inline-size:100%;
  font-family:var(--eg-ui);
  font-weight:300;
  font-size:var(--eg-s--1);
  line-height:1.6;
  color:var(--eg-ink);
  background:var(--eg-white);
  border:1px solid var(--eg-field-line);
  border-radius:2px;
  padding:11px 13px;
  transition:border-color .18s;
  -webkit-appearance:none;
  appearance:none;
}
.wpcf7 textarea, .woocommerce form .form-row textarea, #commentform textarea{min-block-size:150px; resize:vertical}
.wpcf7 select, .woocommerce form .form-row select{
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%236B7168' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat:no-repeat; background-position:right 13px center; padding-inline-end:36px;
}
[dir="rtl"] .wpcf7 select, [dir="rtl"] .woocommerce form .form-row select{background-position:left 13px center}

:is(.wpcf7, .woocommerce, #commentform, .eg-field) :is(input, textarea, select):focus{
  outline:none; border-color:var(--eg-teal); box-shadow:0 0 0 1px var(--eg-teal);
}
.wpcf7 ::placeholder, .woocommerce ::placeholder{color:var(--eg-ink-3); opacity:1}

/* ---- labels ---- */
.wpcf7 label, .woocommerce form .form-row label, #commentform label{
  display:block;
  font-family:var(--eg-mono);
  font-size:var(--eg-s--2);
  letter-spacing:.16em;
  text-transform:uppercase;
  color:var(--eg-ink-3);
  margin-block-end:7px;
}
.woocommerce form .form-row label.checkbox, .wpcf7 label.checkbox{text-transform:none; letter-spacing:0; font-family:var(--eg-ui); font-size:var(--eg-s--1); color:var(--eg-ink-2)}
.woocommerce form .form-row .required{color:var(--eg-teal-ink); text-decoration:none; border:0}

/* ---- layout ---- */
.wpcf7 p{margin-block-end:var(--eg-space-4)}
.wpcf7-form{max-width:52ch}
.woocommerce form .form-row{margin-block-end:var(--eg-space-4); padding:0}
.woocommerce form .form-row-first, .woocommerce form .form-row-last{inline-size:48%; float:none; display:inline-block; vertical-align:top}
.woocommerce form .form-row-first{margin-inline-end:3%}
@media (max-width:620px){ .woocommerce form .form-row-first, .woocommerce form .form-row-last{inline-size:100%; margin-inline-end:0} }

/* ---- submit ---- */
.wpcf7 input[type="submit"], .wpcf7 button[type="submit"],
.woocommerce button.button, .woocommerce a.button, .woocommerce input.button,
.woocommerce #respond input#submit, #commentform input[type="submit"]{
  display:inline-block; inline-size:auto;
  background:var(--eg-teal); color:var(--eg-white);
  border:1px solid var(--eg-teal); border-radius:2px;
  padding:13px 30px;
  font-family:var(--eg-mono); font-size:var(--eg-s--2);
  letter-spacing:.18em; text-transform:uppercase;
  cursor:pointer; transition:background .18s, border-color .18s;
}
.wpcf7 input[type="submit"]:hover, .woocommerce button.button:hover,
.woocommerce a.button:hover, .woocommerce input.button:hover,
.woocommerce #respond input#submit:hover{background:var(--eg-teal-deep); border-color:var(--eg-teal-deep); color:var(--eg-white)}

.woocommerce button.button.alt, .woocommerce a.button.alt, .woocommerce input.button.alt{background:var(--eg-ink); border-color:var(--eg-ink)}
.woocommerce button.button.alt:hover, .woocommerce a.button.alt:hover{background:var(--eg-teal-deep); border-color:var(--eg-teal-deep)}
.woocommerce button.button:disabled, .woocommerce button.button.disabled{opacity:.5; cursor:not-allowed}

/* ---- CF7 messages ---- */
.wpcf7-not-valid-tip{
  display:block; margin-block-start:6px;
  font-family:var(--eg-ui); font-size:var(--eg-s--2); color:var(--eg-warn);
}
.wpcf7 :is(input,textarea,select).wpcf7-not-valid{border-color:var(--eg-warn)}
.wpcf7-response-output{
  margin:var(--eg-space-4) 0 0 !important;
  padding:13px 16px !important;
  border:1px solid var(--eg-rule-2) !important;
  border-inline-start:3px solid var(--eg-teal) !important;
  border-radius:2px;
  background:var(--eg-card);
  font-size:var(--eg-s--1); color:var(--eg-ink-2);
}
.wpcf7 form.invalid .wpcf7-response-output, .wpcf7 form.failed .wpcf7-response-output{border-inline-start-color:var(--eg-warn) !important; background:var(--eg-warn-bg)}
.wpcf7-spinner{margin-inline-start:10px}

/* ---- WooCommerce notices ---- */
.woocommerce-message, .woocommerce-info, .woocommerce-error{
  list-style:none; margin:0 0 var(--eg-space-4); padding:14px 18px;
  border:1px solid var(--eg-rule); border-inline-start:3px solid var(--eg-teal);
  background:var(--eg-card); font-size:var(--eg-s--1); color:var(--eg-ink-2);
  display:flex; flex-wrap:wrap; gap:var(--eg-space-3); align-items:center; justify-content:space-between;
}
.woocommerce-error{border-inline-start-color:var(--eg-warn); background:var(--eg-warn-bg)}
.woocommerce-message::before, .woocommerce-info::before, .woocommerce-error::before{content:none}

/* ---- tables (cart, order, account) ---- */
.woocommerce table.shop_table{inline-size:100%; border-collapse:collapse; border:1px solid var(--eg-rule); font-size:var(--eg-s--1)}
.woocommerce table.shop_table th{
  font-family:var(--eg-mono); font-size:var(--eg-s--2); letter-spacing:.14em; text-transform:uppercase;
  color:var(--eg-ink-3); font-weight:400; text-align:start; padding:13px 16px; background:var(--eg-surface, var(--eg-card)); border-block-end:1px solid var(--eg-rule);
}
.woocommerce table.shop_table td{padding:14px 16px; border-block-end:1px solid var(--eg-rule); color:var(--eg-ink-2)}
.woocommerce table.shop_table .product-name a{color:var(--eg-ink)}

/* ---- product form: one control height, one baseline ----
   WooCommerce and the wishlist plugin each render their own button markup. The
   wishlist button is an <a> containing an icon span and a text span, both
   inline, so at display:block the 24px icon and the text stacked onto separate
   lines and the button grew taller than Add to cart. Flex fixes the alignment;
   a shared min height fixes the row. */

.woocommerce .button,
.woocommerce button.button,
.woocommerce a.button,
.woocommerce input.button,
.wcboost-wishlist-button{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:9px;
  line-height:1.15;
  text-decoration:none;
}

/* The wishlist icon ships at 24px, which dwarfs 11px uppercase mono. */
.wcboost-wishlist-button__icon{display:inline-flex; align-items:center; flex:none}
.wcboost-wishlist-button__icon svg{inline-size:15px; block-size:15px; display:block}
.wcboost-wishlist-button__text{display:inline-block}

/* Every control in the add-to-cart row shares one height. */
.eg-pdp form.cart{align-items:stretch; gap:var(--eg-space-2)}
.eg-pdp form.cart .quantity,
.eg-pdp form.cart .button,
.eg-pdp form.cart .wcboost-wishlist-button{min-block-size:52px}
.eg-pdp form.cart .quantity{display:flex}
.eg-pdp form.cart .quantity input{
  inline-size:74px; block-size:100%; margin:0;
  font-size:var(--eg-s-0); text-align:center;
}
.eg-pdp form.cart .button,
.eg-pdp form.cart .wcboost-wishlist-button{padding-inline:30px}

/* The wishlist is secondary to Add to cart, so it reads as an outline rather
   than a second filled button competing with the primary action.
   Specificity note: WooCommerce styles it via `.woocommerce a.button` (0,2,1),
   so a plain `.eg-pdp .wcboost-wishlist-button` (0,2,0) loses. Matching on the
   element as well takes this to (0,3,1). */
.eg-pdp form.cart a.wcboost-wishlist-button{
  background:transparent;
  color:var(--eg-ink);
  border:1px solid var(--eg-field-line);
}
.eg-pdp form.cart a.wcboost-wishlist-button:hover{
  background:transparent;
  border-color:var(--eg-teal);
  color:var(--eg-teal-ink);
}

/* ---- stock notice ----
   WooCommerce ships an olive #958e09 for in-stock, which fights the palette. */
.woocommerce .stock{
  font-family:var(--eg-mono);
  font-size:var(--eg-s--2);
  letter-spacing:.18em;
  text-transform:uppercase;
  margin-block:var(--eg-space-2);
}
/* WooCommerce colours in-stock with an olive that fights the palette. Its own
   selector is .woocommerce div.product .stock, so match that depth rather than
   reaching for !important. */
.woocommerce div.product p.stock.in-stock,
.woocommerce div.product .summary p.stock.in-stock{color:var(--eg-ink-3)}
.woocommerce div.product p.stock.out-of-stock{color:var(--eg-warn)}

/* Loyalty / points notices sit quietly under the title. */
.wlr_product_message, .wlr-product-message{
  font-family:var(--eg-mono); font-size:var(--eg-s--2);
  letter-spacing:.14em; text-transform:uppercase; color:var(--eg-ink-3);
}

/* ============================================================
   Cart and checkout
   ============================================================ */

/* ---- WPLoyalty notices ----
   The plugin writes every colour as an INLINE style on the element. Its brand
   colours have also been set correctly in the plugin settings (see README), but
   it still renders its #9CC21D default on the cart surface, so the inline style
   has to be overridden here. Beating an inline style requires !important — this
   is the case the keyword exists for, not a shortcut around specificity. */
.woocommerce [class*="wlr-message"]{
  color:var(--eg-teal-ink) !important;
  border-color:var(--eg-rule-2) !important;
  background-color:var(--eg-card) !important;
  border-radius:2px !important;
  font-family:var(--eg-ui) !important;
  font-size:var(--eg-s--1) !important;
  font-weight:300 !important;
  padding:14px 18px !important;
  margin-block:0 var(--eg-space-2) !important;
  gap:12px;
}
/* The plugin leaks an unsubstituted template variable — color:$cart_border_color
   — onto its icon, and ships it at 30px. Both corrected here. */
.woocommerce [class*="wlr-message"] i,
.woocommerce [class*="wlr-message"] .wlr{
  color:var(--eg-teal) !important;
  font-size:17px !important;
  margin:0 !important;
}
.woocommerce [class*="wlr-message"] a{color:var(--eg-teal-ink); border-block-end:1px solid var(--eg-teal)}

/* ---- cart table ---- */
.woocommerce table.shop_table td,
.woocommerce table.shop_table th{border-inline:0}
.woocommerce table.shop_table.cart .product-thumbnail img{
  inline-size:88px; block-size:88px; object-fit:cover; background:var(--eg-linen);
}
.woocommerce table.shop_table.cart .product-name a{
  font-family:var(--eg-serif); font-size:var(--eg-s-1); color:var(--eg-ink); line-height:1.25;
}
.woocommerce table.shop_table.cart .product-name a:hover{color:var(--eg-teal-ink)}
.woocommerce table.shop_table.cart .variation,
.woocommerce table.shop_table.cart dl.variation{
  font-size:var(--eg-s--1); color:var(--eg-ink-2); margin-block-start:6px;
}
.woocommerce table.shop_table.cart .amount{font-variant-numeric:tabular-nums}
.woocommerce table.shop_table.cart .product-quantity input{inline-size:74px; text-align:center}

/* Remove link: woocommerce.css sets `.woocommerce a.remove { color: #a00
   !important }`, so specificity cannot win here and !important is required. */
.woocommerce table.shop_table.cart td.product-remove a.remove{
  color:var(--eg-ink-3) !important;
  font-size:22px; line-height:1; font-weight:300;
  inline-size:26px; block-size:26px;
  display:inline-flex; align-items:center; justify-content:center;
  border-radius:50%; background:transparent;
  transition:color var(--eg-t-fast) var(--eg-ease), background var(--eg-t-fast) var(--eg-ease);
}
.woocommerce table.shop_table.cart td.product-remove a.remove:hover{
  color:var(--eg-warn) !important; background:var(--eg-warn-bg) !important;
}

/* Update cart is secondary; WooCommerce renders it teal with grey text and a
   50% opacity disabled state that reads as broken. */
.woocommerce .actions button[name="update_cart"],
.woocommerce .actions input[name="update_cart"]{
  background:transparent; color:var(--eg-ink); border:1px solid var(--eg-field-line);
  min-block-size:48px; padding-inline:26px;
}
.woocommerce .actions button[name="update_cart"]:hover:not(:disabled){
  background:transparent; border-color:var(--eg-teal); color:var(--eg-teal-ink);
}
.woocommerce .actions button[name="update_cart"]:disabled{
  opacity:1; color:var(--eg-ink-3); border-color:var(--eg-rule); background:transparent; cursor:default;
}

/* ---- cart totals ---- */
.woocommerce .cart_totals h2, .woocommerce-checkout h3{
  font-family:var(--eg-serif); font-size:var(--eg-s-2); letter-spacing:-.012em; margin-block-end:var(--eg-space-4);
}
.woocommerce .cart_totals table.shop_table th{inline-size:38%; vertical-align:top}
.woocommerce .cart_totals .order-total .amount{font-family:var(--eg-serif); font-size:var(--eg-s-1)}
.woocommerce .wc-proceed-to-checkout{padding-block-start:var(--eg-space-4)}
.woocommerce .wc-proceed-to-checkout a.checkout-button{
  display:flex; inline-size:100%; min-block-size:56px;
  font-size:var(--eg-s--2); letter-spacing:.22em;
  background:var(--eg-teal); border-color:var(--eg-teal);
}
.woocommerce .wc-proceed-to-checkout a.checkout-button:hover{background:var(--eg-teal-deep); border-color:var(--eg-teal-deep)}

/* ---- empty cart ---- */
.woocommerce .cart-empty{font-family:var(--eg-serif); font-size:var(--eg-s-2); color:var(--eg-ink)}
.woocommerce .return-to-shop{margin-block-start:var(--eg-space-4)}

/* ---- cart and checkout on a phone ----

   eg_trim_woo_styles() dequeues woocommerce-smallscreen.css, whose entire job
   is making these tables readable below tablet width. Nothing replaced it, so
   a cart holding a single line measured 480px inside a 375px viewport: the
   page scrolled sideways and the product column was cut off the screen.

   This is that stylesheet's work, done in the theme's own idiom rather than
   by re-enqueueing 8.6KB that would fight the design. The row becomes a card;
   each figure keeps its column heading through data-title, which WooCommerce
   already puts on every cell in cart.php. */
@media (max-width:700px){
  .woocommerce table.shop_table.cart,
  .woocommerce table.shop_table.cart tbody,
  .woocommerce table.shop_table.cart tr,
  .woocommerce table.shop_table.cart td{display:block; inline-size:auto}
  .woocommerce table.shop_table.cart{border:0}
  .woocommerce table.shop_table.cart thead{display:none}

  .woocommerce table.shop_table.cart tr.cart_item{
    display:grid;
    grid-template-columns:68px minmax(0,1fr) auto;
    column-gap:var(--eg-space-3);
    row-gap:9px;
    align-items:start;
    border:1px solid var(--eg-rule);
    background:var(--eg-card);
    padding:var(--eg-space-3);
    margin-block-end:var(--eg-space-3);
  }
  .woocommerce table.shop_table.cart tr.cart_item td{padding:0; border-block-end:0}

  .woocommerce table.shop_table.cart td.product-thumbnail{grid-column:1; grid-row:1}
  .woocommerce table.shop_table.cart td.product-thumbnail img{inline-size:68px; block-size:auto}
  .woocommerce table.shop_table.cart td.product-name{grid-column:2; grid-row:1}
  .woocommerce table.shop_table.cart td.product-remove{grid-column:3; grid-row:1; justify-self:end}

  /* Each figure carries its own heading, since the thead is gone. */
  .woocommerce table.shop_table.cart td.product-price,
  .woocommerce table.shop_table.cart td.product-quantity,
  .woocommerce table.shop_table.cart td.product-subtotal{
    grid-column:1 / -1;
    display:flex; align-items:center; justify-content:space-between; gap:var(--eg-space-3);
    border-block-start:1px solid var(--eg-rule);
    padding-block-start:9px;
    min-block-size:44px;
  }
  .woocommerce table.shop_table.cart td.product-price::before,
  .woocommerce table.shop_table.cart td.product-quantity::before,
  .woocommerce table.shop_table.cart td.product-subtotal::before{
    content:attr(data-title);
    font-family:var(--eg-mono); font-size:var(--eg-s--2);
    letter-spacing:.14em; text-transform:uppercase; color:var(--eg-ink-3);
  }
  .woocommerce table.shop_table.cart td.product-subtotal .amount{
    font-family:var(--eg-serif); font-size:var(--eg-s-1);
  }

  /* Coupon and update stack rather than sharing a row 120px too narrow. */
  .woocommerce table.shop_table.cart td.actions{
    display:flex; flex-direction:column; gap:var(--eg-space-3);
    border:1px solid var(--eg-rule); padding:var(--eg-space-3);
  }
  .woocommerce table.shop_table.cart td.actions .coupon{
    display:flex; flex-direction:column; gap:9px;
  }
  .woocommerce table.shop_table.cart td.actions .button,
  .woocommerce table.shop_table.cart td.actions input[type="text"]{inline-size:100%}

  /* Totals: the label column at 38% leaves too little for the figure. */
  .woocommerce .cart_totals table.shop_table th{inline-size:auto}
  .woocommerce .cart_totals table.shop_table th,
  .woocommerce .cart_totals table.shop_table td{padding-inline:12px}
}

/* ---- variation swatches ----

   The theme never styled these. Two swatch plugins were installed and the one
   that painted brought its own look, so the buttons happened to appear
   designed. Retiring it for the accessible one left them unstyled — which is
   the right time to notice the theme should own this rather than inherit
   whichever plugin is installed this month. */
.wcboost-variation-swatches__wrapper{
  display:flex; flex-wrap:wrap; gap:9px;
  list-style:none; margin:0; padding:0;
}
.wcboost-variation-swatches__item{
  box-sizing:border-box; cursor:pointer;
  transition:border-color var(--eg-t-fast) var(--eg-ease),
             color var(--eg-t-fast) var(--eg-ease),
             background var(--eg-t-fast) var(--eg-ease);
}

/* Text swatches — the set options, the weave, the size. */
.wcboost-variation-swatches--label .wcboost-variation-swatches__item,
.wcboost-variation-swatches--button .wcboost-variation-swatches__item{
  display:inline-flex; align-items:center; justify-content:center;
  min-block-size:38px; padding:7px 15px;
  border:var(--eg-hair) solid var(--eg-field-line);
  background:var(--eg-card);
  font-family:var(--eg-mono); font-size:var(--eg-s--2);
  letter-spacing:.14em; text-transform:uppercase;
  color:var(--eg-ink-2); white-space:nowrap;
}
.wcboost-variation-swatches--label .wcboost-variation-swatches__item:hover,
.wcboost-variation-swatches--button .wcboost-variation-swatches__item:hover{
  border-color:var(--eg-teal); color:var(--eg-teal-ink);
}
.wcboost-variation-swatches--label .wcboost-variation-swatches__item.selected,
.wcboost-variation-swatches--button .wcboost-variation-swatches__item.selected{
  border-color:var(--eg-teal-deep); color:var(--eg-ink);
  background:var(--eg-paper);
  box-shadow:inset 0 0 0 var(--eg-hair) var(--eg-teal-deep);
}

/* Colour swatches — the colour is the content, so the name is for listening
   to rather than reading. */
.wcboost-variation-swatches--color .wcboost-variation-swatches__item{
  inline-size:34px; block-size:34px; padding:0;
  border:var(--eg-hair) solid var(--eg-field-line);
  background-color:var(--wcboost-swatches-item-color, transparent);
}
.wcboost-variation-swatches--color .wcboost-variation-swatches__name{
  position:absolute; inline-size:1px; block-size:1px;
  overflow:hidden; clip-path:inset(50%); white-space:nowrap;
}
.wcboost-variation-swatches--color .wcboost-variation-swatches__item:hover{
  border-color:var(--eg-teal);
}
/* A ring rather than a border, so the swatch keeps its full colour area. */
.wcboost-variation-swatches--color .wcboost-variation-swatches__item.selected{
  border-color:var(--eg-teal-deep);
  outline:var(--eg-hair) solid var(--eg-teal-deep);
  outline-offset:3px;
}

/* An option the current selection rules out. */
.wcboost-variation-swatches__item[aria-disabled="true"],
.wcboost-variation-swatches__item.disabled,
.wcboost-variation-swatches__item.wcboost-variation-swatches__item--disabled{
  opacity:.4; cursor:not-allowed;
}

.wcboost-variation-swatches__item:focus-visible{
  outline:2px solid var(--eg-teal); outline-offset:3px;
}

@media (pointer: coarse){
  .wcboost-variation-swatches--label .wcboost-variation-swatches__item,
  .wcboost-variation-swatches--button .wcboost-variation-swatches__item{min-block-size:44px}
  .wcboost-variation-swatches--color .wcboost-variation-swatches__item{inline-size:44px; block-size:44px}
}

/* WooCommerce lays the chooser out as a two-column table, label beside
   options. On a phone the label column takes a third of the width and wraps
   to three lines while the options queue up in what is left. Stack them. */
@media (max-width:600px){
  .woocommerce table.variations,
  .woocommerce table.variations tbody,
  .woocommerce table.variations tr,
  .woocommerce table.variations th,
  .woocommerce table.variations td{display:block; inline-size:auto}
  .woocommerce table.variations tr{margin-block-end:var(--eg-space-3)}
  .woocommerce table.variations th.label{
    padding:0 0 8px; text-align:start;
  }
  .woocommerce table.variations td.value{padding:0}
}
